Professional Documents
Culture Documents
1/8
Overview
Writing your first WDK component? Like most developers you probably just want to jump in and start coding without reading associated developer documentation1. Obviously, we would never do this ourselves right! This paper will walk you through the process of adding a new component to WebTop; the component will be invoked from a menu item. The paper covers the steps involved in adding the menu item, the associated action and the actual component. The component will simply display 'Hello World' in the WebTop main frame.
Revisions
December 2003 Added instructions for adding the XML config file for the custom menubar component.
References
The following are all great references for use when building your own WDK components. Overview of the Development and Customization Options, WDK node http://www.documentum.com/developer/Roadmap5/index.htm Web Development Kit Development Guide Web Development Kit and Applications Tutorial http://support.documentum.com/support/documentation/dmDocList.asp
Customization Type
Documentum WDK 5.2 Component
Programming Language
Java
Software Environment
Operating System Compiler Runtime Environment Web Browser Application Server WDK version Webtop version WebPublisher DAM EContent Server DFC Tested on Windows 2000 Professional SP3 Sun JDK 1.4.1_02 Sun JRE 1.4.1_02 Microsoft Internet Explorer 6.0 SP1 Apache Tomcat/4.0.6 5.2 5.2 Not tested Not Tested 5.2 5.2.0.55
Visit Tech Support's documentation section and search for WDK documents to find the development guides and JavaDocs.
2/8
Process Overview
The steps involved in adding a component are shown below. The paper will look at each of the steps in detail and point out the 'hooks' between each step in the process.
Steps
Add the menu item to the WebTop menu bar
Technical Note
Development of this sample was done using Apache Tomcat 4, the paper refers to <VIRTUAL_ROOT>; this is typically C:\Program Files\Apache Tomcat 4.0\webapps\webtop\.
In this paper we are not going to explore all of the options available to you when defining a menu item, we will however take a look at the options we have selected.
Value dynamic='genericnoselect' name='hello_world_menu_item' value='Hello World' action='hello_world_action' showifinvalid='true'
Explanation This menu item will be displayed only if no files or folders have been selected. This is the name of the menu item; in this example we will not need to use this value. This is the text of the menu item. (It should really be held in a language specific resource string.) This is the name of the action that will be invoked. It must match the name field of the action created in the next step. This specified whether the menu item should appear grayed out in the menu or be hidden when it is not valid.
3/8
Next, we need to tell the WDK framework that we are using a custom menubar component. We do this by adding an XML file to <VIRTUAL_ROOT>\custom\config that tells the framework where to look for the custom menubar. Create a file called menubar_component.xml in <VIRTUAL_ROOT>\custom\config. Add the following text to it:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> <config version='1.0'> <scope> <component id="menubar" extends='menubar:/webtop/config/menubar_component.xml'>
Now we have a new menu item in the WebTop 'classic view' file menu. If you restart Tomcat and WebTop you should see the menu item. Note that the menu item is grayed out even though we specified that it should always be active, this is because WebTop was unable to resolve the reference to the action.
Let's take a quick look at the important parts of the file. Value
<action id="hello_world_action">
Description This is the name of the action, it must be unique. It must match the value of the 'name' field specified in the 4/8
menubar.jsp file.
execution class="com..LaunchComponent">
You can call any class from the action including your own custom classes. In our example we are going to use one of the built-in WDK classes to launch our component. This is the name of the component we are going to launch. It needs to match the component name in the component XML file that we will be creating in the next step. This tag is optional for our hello_world example, it instructs WebTop to display the output from the component wrapped in a container that adds OK, Cancel and Help buttons and a pretty blue border.
The next step in the process is to define the actual component to be displayed.
5/8
Description This is the name of the component, it must be unique. It must match the name specified in the hello_world_action.xml file's <component/> tag. This defines the jsp file to be used by the component. This defines the class file to be used by the component.
The last part of the process is to create the JSP and class files that actually make up the component. We will focus on the JSP file first and then the class file.
6/8
Create a folder called hello_world in your <VIRTUAL_ROOT>\custom\ folder, copy this text into a file called hello_world.jsp and save the file to your new folder. Don't worry about all of the page, taglib and dmf references just know that the WDK framework requires all of these to be able to handle the JSP file as a component. Our worthy addition to the code is the beautifully formatted 'Hello World' line.
This is the bare minimum code required in a component's class file. It overrides the component onInit() method and then does nothing except call the original onInit() method. Copy this code into DummyComponent.java and compile it. Copy the resultant class file into <VIRTUAL_ROOT>\WEB-INF\classes\com\documentum\custom\library.
2
Yes we know it is technically possible to create a component from only a JSP file but it is not recommended.
7/8
Bug Submissions
If you find bugs or issues with the component, please contact developer_program@documentum.com with a short description of the issue, steps to reproduce it and the relevant software environment.
Note: This customization will only appear in the Classic view, not in the Streamline view
8/8