WDK Tutorial 42

Download as pdf or txt
Download as pdf or txt
You are on page 1of 60

Documentum Web Development Kit Tutorial

Version 4.2 April 2001

DOC3-WDKTUT-0401

*1040-TUTKDW-3C OD*

Copyright 2000, 2001 Documentum, Inc. 6801 Koll Center Parkway Pleasanton, CA 94566 All Rights Reserved.

Documentum, Documentum 4i, Docbase, Documentum eContent Server, Documentum Server, Documentum Desktop Client, Documentum Intranet Client, Documentum WebPublisher, Documentum ftpIntegrator, Documentum RightSite, Documentum Administrator, Documentum Developer Studio, Documentum Web Development Kit, Documentum Web Gear, Documentum WebCache, Documentum ContentCaster, AutoRender Pro, Documentum iTeam, Documentum Reporting Gateway, Documentum Content Personalization Services, Documentum Site Delivery Services, Documentum Content Authentication Services, Documentum Dynamic Content Assembler, Documentum DocControl Manager, Documentum Corrective Action Manager, Documentum eConnector for BEA WebLogic (BEA and WebLogic are registered trademarks of BEA Systems), Documentum eConnector for JDBC, Documentum eConnector for CAD, Documentum eConnector for SAP (SAP is a trademark of SAP AG), Documentum eConnector for Lotus Notes (Lotus Notes is a registered trademark of Lotus Development Corporation), DocInput, Documentum DocViewer, GMPharma, Virtual Document Manager, Docbasic, Documentum WorkSpace, Documentum SmartSpace, and Documentum ViewSpace are trademarks or registered trademarks of Documentum, Inc. in the United States and throughout the world. All other company and product names are used for identification purposes only and may be trademarks of their respective owners.

CONTENTS

Preface 1 What is the Web Development Kit?


What WDK Is and What it Can Do . Compliance With Java Specifications Dependencies on Other Software . . Fitting the Pieces Together . . . . . . Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 . 1-2 . 1-3 . 1-3 . 1-6

JavaServer Pages in the WDK


Anatomy of a Typical WDK Server Page . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1 HTML Generated by JSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 Handling Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3

Developing an Application
Prepare Your Environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Plan the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Create the Application Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . Locate the Tutorial Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Create a Page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Add the Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Add Event Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Enable Actions on Docbase Contents . . . . . . . . . . . . . . . . . . . . . . . . . Extra Investigation: Use Cascading Style Sheets to Customize the Look of Your Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1 . 3-2 . 3-3 . 3-5 . 3-5 . 3-7 3-10 3-12

. . 3-13 . . . . . . . . . . . . . . . 4-1 . 4-1 . 4-2 . 4-3 . 4-3 . 4-3 . 4-4

Customizing WDK Components


Modify a Menu . . . . . . . . . . . . . . . . Before you begin . . . . . . . . . . . . . Remove the menu items . . . . . . . . Extra investigation: Add a menu item. Add a Column to a View . . . . . . . . . . . Before you begin . . . . . . . . . . . . . Add the column to the view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Displaying Properties of a Custom Object Type


Display Custom Properties of a Custom Object Type . . . . . . . . . . . . . . . . . . . 5-1 Before you begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Display the custom properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2

Documentum Web Development Kit Tutorial

iii

Extra Investigation: Searching for Properties of a Custom Object Type . . . . . . . . 5-3

Solution Code
wdkSkeletonPage.jsp . . . . . wdkTutorial0_finished.jsp . . wdkTutorial1_finished.jsp . . toolbarTutorial_finished.jsp . wdkTutorial2_finished.jsp . . wdkTutorial3_finished.jsp . . folderContents.jsp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2 . A-3 . A-4 . A-5 . A-7 . A-9 A-11

iv

Documentum Web Development Kit Tutorial

PREFACE

Purpose of the Manual


This manual provides an introduction to the basic features of the Documentum Web Development Kit (WDK) using both conceptual information and hands-on examples. For detailed WDK information, including installation instructions, information on developing and configuring web applications with the WDK, and reference material, see:
s Installation and Release Notes s Online Help s API Documentation (Javadoc)

All of these documents are available in the docs directory that resides in the WDK installation directory.

Intended Audience
This manual is designed for web developers and designers who will use the WDK to add Documentum functionality to web applications. It assumes that you are familiar with JavaServer Pages, web applications, JavaScript, and HTML. Numerous books that cover these topics are available commercially, and you can also consult the following documents at http://java.sun.com:
s Java Servlet Specification, version 2.2 s JavaServer Pages Specification, version 1.1

Organization of the Manual


The following table describes the contents of the chapters and appendixes of this book.

Documentum Web Development Kit Tutorial

Chapter Chapter 1, What is the Web Development Kit? Chapter 2, JavaServer Pages in the WDK Chapter 3, Developing an Application

Contents Describes the contents of the WDK and how it works with your HTTP server and application server. Describes how JavaServer Pages are used to drive WDK-based web applications. Contains step-by-step examples of how to build a simple web application based on the WDK.

Chapter 4, Customizing WDK Contains step-by-step examples of how to customize Components a menu and a view. Contains step-by-step examples of how to display the Chapter 5, Displaying Properties of a Custom Object properties of a custom object type in the properties page of WDK. Type Appendix A, Solution Code Lists the solutions for each tutorial exercise.

Conventions
This manual uses the following conventions:
Convention Description Represents a pop-up or pull-down menu. Indicates the introduction to a procedure. italics typewriter [] square brackets {} braces (curly brackets) Represents a variable name for which you must provide a value, or a defined term. Represents code samples, user input, and computer output. Indicates an optional argument. Indicates an optional argument that can be repeated more than once.

vi

Documentum Web Development Kit Tutorial

Using Links in PDF Files


If you are reading this document as a Portable Display Format (PDF) file, cross-references and page numbers in the index are clickable blue hypertext links. Table of contents page numbers are also clickable links, but they appear in black. Each server book contains many clickable cross-references to the other server books. Cross-references to manuals other than the one you are reading only work if the PDF files are all in the same directory and have the same file names that they have on the server release CD.

To follow a link: Move the pointer over a linked area. The pointer changes to a pointing finger when positioned over a link. The finger pointer displays a W when moved over a Weblink.

1.

2.

Click to follow the link. Note: To follow Web links, your Weblink preferences must specify a Web browser. See Setting Weblink preferences in your Adobe Acrobat Help for more information.

Bug Lists and Documentation Online


Customers with a software support agreement can read our product documentation and, after commercial release of a product, view lists of fixed bugs on our Technical Support web pages. To view this information you must apply for access to the Technical Support area.

Applying for Access

To apply for access: In your browser, open http://www.documentum.com/ Choose the Customer Service Technical Support link.

1. 2.

Documentum Web Development Kit Tutorial

vii

3. 4.

Click the Request Access link. Complete the form and submit it. Documentum will respond to your request within two business days.

Fixed Bugs List


Within two weeks from the date of this release, Documentum places a list of fixed bugs in the Technical Support area of documentum.com. The list includes all customer-related bugs that the current release corrects. For information about obtaining access to the Technical Support area of the Web site, refer to Applying for Access on page vii. You must have Adobe Acrobat Reader or Acrobat Exchange installed to view the lists of fixed bugs.

To view the list of fixed bugs: In your browser, open http://www.documentum.com/ Choose the Customer Service Support Logon link. Log on to the Technical Support site. In the Troubleshooting section, click Fixed Bugs Lists. Click the product name link for a products bug list.

1. 2. 3. 4. 5.

Product Documentation
Customers with a software support agreement can read our product documentation at documentum.com. To view the documentation, you must have a user name and password, and Adobe Acrobat Exchange or Acrobat Reader installed. To obtain a user name and password, refer to Applying for Access on page vii.

To view a document: In your browser, open http://www.documentum.com/ Choose the Customer Service Support Logon link. Log on to the Technical Support site. In the left pane, click Documentation.

1. 2. 3. 4.

viii

Documentum Web Development Kit Tutorial

5. 6.

To list documents, select a sorting method in the List Documentation By field, and click List. Click the name of the document you wish to view.

Purchasing Bound Paper Manuals


Our product documentation is available for purchase as bound paper manuals. To place an order, call the Documentation Order Line at (925) 6006666. You can pay with a purchase order, check, or credit card.

Documentum Web Development Kit Tutorial

ix

Documentum Web Development Kit Tutorial

What is the Web Development Kit?

1
1

This chapter provides a basic introduction to the Documentum Web Development Kit (WDK), the development environment that it uses, and the web applications that it allows you to build. There are no tutorial exercises in this chapter, but this information is essential to understanding the WDK. This chapter contains the following sections:
s What WDK Is and What it Can Do on page 1-1 s Compliance With Java Specifications on page 1-2 s Dependencies on Other Software on page 1-3 s Fitting the Pieces Together on page 1-3 s Summary on page 1-6

What WDK Is and What it Can Do


The WDK is a set of tools with which you can build custom web applications that include Documentum functionality and run on a Java application server. A web application is a collection of JavaServer Pages, servlets, classes, HTML pages, JAR files, and any other resources that can be bundled together and deployed as a standalone application on a Java application server. Users launch and use the web application in a web browser. With WDK, your web applications can include document management features such as checkout and checkin, workflows, lifecycles, and virtual documents. The WDK consists of the following tools:
s Java classes that conduct Docbase operations. These classes include:

Documentum Web Development Kit Tutorial

11

What is the Web Development Kit?


Compliance With Java Specifications

Command classes that conduct Docbase operations. Content transfer classes that manage checkout, checkin, import, and

export of documents and XML between clients and a Docbase. The content transfer classes install and use content transfer applets in the client browser. The command classes and content transfer classes rely on the Documentum Foundation Classes (DFC) to provide basic Docbase functionality.
s Java classes for models and views of Documentum objects, such as models

and views of the folder hierarchy in a Docbase or the document hierarchy in a virtual document.
s Java classes that manage configuration, context, menus, localization,

events, and exceptions.


s JavaServer Pages that provide Documentum functionality by instantiating

objects based on the Java classes and creating standard user interfaces. JSP pages can contain both server-side Java code and client-side HTML and JavaScript code, allowing you to generate dynamic content on the server and control its presentation and behavior on the client. You can customize these JSP pages as desired for your application.
s JavaScript functions and event handlers that support the user interfaces in

the JSP pages. Some JavaScript functions reside in associated JSP pages, while others reside in files that contain only JavaScript.
s Services that allow you to configure your application and its components

with XML, which reduces the amount of time and programming expertise required to develop your application.
s API documentation (Javadocs) for the WDK and DFC classes, and online

help (Javahelp) that contains documentation for the JavaServer pages and application development tasks.

Compliance With Java Specifications


The tools in WDK conform to the following specifications, available at http:// java.sun.com:
s Java Servlet Specification, version 2.2 s JavaServer Pages Specification, version 1.1

12

Documentum Web Development Kit Tutorial

What is the Web Development Kit?


Dependencies on Other Software

To deploy and run a web application that is built on WDK, you require a Java application server that supports both of these specifications.

Dependencies on Other Software


Before you develop a web application using WDK, you must install and configure the following server software:
s An HTTP server, which can reside on your development machine or on a

separate machine.
s A Java application server, which communicates with the HTTP server and

typically (but not always) resides on the same machine as the HTTP server. The Java application server must support both the Java Servlet Specification, version 2.2, and the JavaServer Pages Specification, version 1.1.
s A Documentum eContent server and Docbase, which is accessed through a

Docbroker and can reside on any machine. These products are separate from the WDK. To install and configure these products, refer to their installation instructions and documentation. To conduct the exercises in this tutorial, you need:
s The server software described above. s A text editor on your development machine that reads and writes plain

ASCII by default and does not reformat or automatically wrap lines that you type. You can optionally use a J2EE-compliant integrated development environment (IDE) for Java on your development machine.

Fitting the Pieces Together


As you develop your web application, you typically work with local files and a development server, and you revise and add files as the application evolves. When your web application is complete and ready to deploy on a production application server, you use Java archive tools to package all of the files and

Documentum Web Development Kit Tutorial

13

What is the Web Development Kit?


Fitting the Pieces Together

resources into a single Web Archive (WAR) file. You then use the tools provided by your Java application server to deploy the WAR file as an application on your production server. Deployment procedures differ among application servers. For deployment details, consult the documentation for your application server. For a detailed description of web applications and the WAR file format, refer to the Java Servlet Specification, version 2.2, available at http://java.sun.com. After a web application is deployed on the application server, a user launches the application by requesting the applications start page in a web browser. The following steps describe what happens when a user requests the applications start page. Figure 1-1 illustrates these steps. 1. User launches a web browser and requests the applications start page, for example, http://appserver/appname/wdkSpace/wdkSpace.jsp. Appserver is the name of your application server and appname is the name of your WDK-powered application. 2. The browser sends this request to the HTTP server. 3. The HTTP server recognizes that this is a request for a JSP page, not an HTML page, and it passes the request to the Java application server. 4. The Java application server then retrieves the JSP page and compiles it into a servlet if necessary. JSP pages are compiled the first time they are requested. The application server then saves the compiled servlet for use by subsequent requests. 5. The Java application server runs the compiled servlet, executing the server-side Java instructions and accessing the Docbase as necessary. The servlet produces a response that consists solely of HTML and JavaScript. 6. The Java application server sends the response (HTML + JavaScript) to the HTTP server. 7. The HTTP server sends the response to the users browser, which processes any JavaScript in the response and displays the HTML in the response.

14

Documentum Web Development Kit Tutorial

What is the Web Development Kit?


Fitting the Pieces Together

Figure 1-1

Displaying an Applications Start Page in a Browser


W eb server machine (hardware) W AR file wdkSpace.jsp

Java application server (software) Compile the JSP into a servlet 4 5 Run the servlet; generate HTML/JavaScript 6 HTTP server (software) G et the JSP file

Server machine (hardware)

Docbase

7 Client machine (hardware) Browser (software) Address:

http://appserver/appname/wdkSpace/wdkSpace.jsp

Java Virtual Machine (software)

Documentum Web Development Kit Tutorial

15

What is the Web Development Kit?


Summary

Summary
s The WDK is a set of tools with which you can build a web application that

has Documentum functionality.


s A web application is a collection of pages, classes, and any other resources

that constitute a standalone application on a Java application server. Web applications are described in the Java Servlet Specification, version 2.2.
s To develop and deploy a web application with WDK, you need an HTTP

server, a Java application server, and a Documentum eContent Server and Docbase.

16

Documentum Web Development Kit Tutorial

JavaServer Pages in the WDK

2
2

WDK functionality is presented primarily via JavaServer Pages, also known as JSP pages. (The term JSP pages seems redundant, but this is the terminology used in the JavaServer Pages Specification.) You can think of a JSP page as the source code for a servlet whose sole function is to produce an HTTP response object from an HTTP request object. For example, a web browser requests a JSP page and includes any information that the JSP requires, such as IDs of objects in the Docbase. The request goes to the HTTP server, which passes it to the application server. The application server compiles the requested JSP into a servlet (in many cases, the JSP is already compiled) and runs the servlet using the information provided with the request. The output from the servlet is the response, which consists of HTML and JavaScript. This response is returned to the browser and displayed. Detailed information on servlets and JSP pages is available in Java Servlet Specification, version 2.2, and the JavaServer Pages Specification, version 1.1. These specifications are available at http://java.sun.com. This chapter describes how JSP pages are used in the WDK. It contains the following sections:
s Anatomy of a Typical WDK Server Page on page 2-1 s HTML Generated by JSP on page 2-3 s Handling Errors on page 2-3

Anatomy of a Typical WDK Server Page


Most JSP pages in the WDK have the following general structure: 1. Page language and page info directives, which typically specify the content type, encoding, language, error page, and application name. For example:

Documentum Web Development Kit Tutorial

21

JavaServer Pages in the WDK


Anatomy of a Typical WDK Server Page

<%@ page contentType="text/html; charset=UTF-8"%> <%@ page language="java" errorPage="/wdk/component/error/error.jsp"%> <%@ page info="WDK Application"%>

2.

Import the Java classes required by the page. Most JSP pages in the WDK use the following classes:
s com.documentum.wc.env.jsp.DwJSPPageContext

DwJSPPageContext is the page context object, which binds to the WDK namespace and reads the application configuration file. Use the page context object to acquire all of the persistent objects needed for the page, such as the web application (DwApplication), application session (DwAppSession), and page set (DwPageSet).
s com.documentum.wc.env.DwPageSet

DwPageSet is used to store state information for a group of pages that are used in a single business transaction. For example, the task manager page set caches queue item IDs, work item IDs, the document list model, the object ID of a selected document, and the package ID for that document.
s com.documentum.wc.env.DwAppSession

DwAppSession is the web application session object. The application session checks the login requirements. If the user has no active session, the login page specified in the config.xml for the application is presented. To create or acquire a DwAppSession, use the method DwJSPPageContext.acquireSession.
s com.documentum.wc.env.DwApplication

DwApplication is the application object, which is used to create other application-level objects or to get a URL to the root folder of the application. 3. 4. 5. Create the DwJSPPageContext object. For example:
DwJSPPageContext wdkPageContext = new DwJSPPageContext(pageContext.getServletContext(), request, response, true);

The try block. Most of the code on each WDK server page is enclosed in a Java try...catch block. Create the application object, page set, and application session. For example:
DwApplication app = DwApplication.getApplication(); DwPageSet pageSet = wdkPageContext.getPageSet(); DwAppSession appSession = wdkPageContext.acquireSession();

6. 7.

Java code. The HTML block, including any JavaScript. Most WDK server pages include the following JavaScript files in the HTML block:

22

Documentum Web Development Kit Tutorial

JavaServer Pages in the WDK


HTML Generated by JSP

s events.js, which contains functions that support cross-frame events and

manage the propagation of events.


s url.js, which contains functions that add, remove, and retrieve URL

arguments.
s history.js, which contains functions that that are used by the event handlers

in WDK to call or return to a JSP page. 8. 9. Release the application session:


wdkPageContext.releaseSession();

The catch block, which handles exceptions that were thrown in the try block and ensures that the application session is released.

HTML Generated by JSP


The output of a JSP page (more accurately, the output of the servlet that that is created from the JSP page) consists of HTML and JavaScript that is returned to the web browser. This HTML and JavaScript has two sources:
s Static HTML and JavaScript, which are hard-coded in the JSP page. s Dynamic HTML and JavaScript, which are generated by the Java code in

the JSP page and by Java classes that are called by the JSP page. These two sources are not distinguishable in the HTML and JavaScript that is returned to the browser. As far as the web browser is concerned, it is simply static HTML and JavaScript to process and display. This distinction between static and dynamic content supports a convenient separation of roles on your web development team. A page design team can develop the static elements, and a programming team can develop the dynamic elements.

Handling Errors
Java classes in the WDK throw Java exceptions when critical errors occur, for example, when a Docbase is not available. The code in the JSP page must handle these exceptions, or page execution halts completely.

Documentum Web Development Kit Tutorial

23

JavaServer Pages in the WDK


Handling Errors

In the JSP pages in WDK, the code in the page is enclosed in a Java try...catch block. For example:
try { page code } catch(Exception err) { error-handling code }

At the end of the try block, release any established application session to free session objects that are no longer in use. For example:
DwJSPPageContext.releaseSession();

In the catch block, handle any exceptions that were raised in the try block. Minimally, the catch block must:
s Catch the exception. s Release the application session. For example,

DwJSPPageContext.releaseSession();
s Set attributes on the request object. For example,

request.setAttribute(ErrorDescription, <error-text>)
s Re-throw the caught exception, which triggers the intrinsic JSP/Servlet

error handling mechanism. Control is then redirected to the active error page. The WDK error page is error.jsp, which uses the class DwExceptionView to report the error.

24

Documentum Web Development Kit Tutorial

Developing an Application

3
3

This chapter describes how to create a simple application that uses components of the Web Development Kit. The application will allow you to log in and out of a Docbase, view your Inbox, and browse Docbase contents. The chapter contains the following sections:
s Prepare Your Environment on page 3-1 s Plan the Application on page 3-2 s Create the Application Directory on page 3-3 s Locate the Tutorial Files on page 3-5 s Create a Page on page 3-5 s Add the Toolbar on page 3-7 s Add Event Handlers on page 3-10 s Enable Actions on Docbase Contents on page 3-12 s Extra Investigation: Use Cascading Style Sheets to Customize the Look of

Your Application on page 3-13

Prepare Your Environment


Before you begin the exercises in this chapter, you must install WDK and the sofware on which it depends. You must also ensure that you can load JSP pages successfully. The following procedure describes all of these tasks.

To prepare and test your web application environment: Ensure that your HTTP server, Java application server, and Documentum eContent server and Docbases are installed and configured. For more information, see Dependencies on Other Software on page 1-3. Although these software packages are not part of the WDK, the WDK relies on their correct configuration.

1.

Documentum Web Development Kit Tutorial

31

Developing an Application
Plan the Application

2. 3.

To test your application server, load a JSP page in your browser. Most application servers include sample JSP pages for testing purposes. Install the Web Development Kit and deploy the wdkSpace sample application in exploded directory format. In exploded directory format, the .war file is expanded as a collection of files that use a directory structure. The exercises in this manual rely on successful installation and configuration of the WDK. The Documentum Web Development Kit Installation and Release Notes contains critical information for configuring WDK. Follow the instructions closely to deploy the wdkSpace sample application and test the installation.

Plan the Application


In the following sections, you will create a simple application named wdkTutorial. This application allows you to log in and browse available Docbases, view your Documentum Inbox, and log out of a Docbase. The user interface includes a Docbase tree frame on the left, a folder browsing frame on the right, and a toolbar frame across the top:

32

Documentum Web Development Kit Tutorial

Developing an Application
Create the Application Directory

Create the Application Directory


In this section, you will create a new web application root directory named wdkTutorial, and then you will copy files from the wdkSpace sample application into the new wdkTutorial application root directory. Copying files from the wdkSpace sample application will ensure that the WDK framework is available to the wdkTutorial application. Before you begin, ensure that the wdkSpace sample application is deployed in exploded directory format. In exploded directory format, the .war file is expanded as a collection of files that use a directory structure. For instructions on deploying the wdkSpace sample application, see the Documentum Web Development Kit Installation and Release Notes.

Documentum Web Development Kit Tutorial

33

Developing an Application
Create the Application Directory

To create the directory for the wdkTutorial application: Create a new, empty web application and corresponding root directory named wdkTutorial. How you create a new web application and root directory depends on your application server and operating system. For specific instructions, refer to the documentation for your application server. Copy the contents of the deployed wdkSpace sample application directory to your new wdkTutorial application directory. (Ensure that you copy from the deployed wdkSpace sample application, not the WDK installation location.) Your wdkTutorial application directory now has the following structure:
\wdkTutorial config.dtd config.xml \wdk \wdkSpace \WEB-INF

1.

2.

3.

Rename the wdkSpace directory to wdkTutorial. This wdkTutorial subdirectory will contain the files that are specific to the wdkTutorial application. Your wdkTutorial application directory now has the following structure:
\wdkTutorial config.dtd config.xml \wdk \wdkTutorial \WEB-INF

4.

Navigate to the css directory below the wdkTutorial directory. Rename the two files as follows:
s Rename wdkSpace.css to wdkTutorial.css. s Rename wdkSpaceBase.css to wdkTutorialBase.css.

5.

If necessary, restart your application server to activate the wdkTutorial application.

34

Documentum Web Development Kit Tutorial

Developing an Application
Locate the Tutorial Files

Locate the Tutorial Files


The files that you will use in this tutorial are packaged in the archives WDK_Tutorial_42_Files.zip (for Windows) and WDK_Tutorial_42_Files.tar.gzip (for Unix). These archives reside in the docs directory in your WDK installation directory. Locate the archive for your system and extract its files to the \wdkTutorial\wdkTutorial directory. (This is the wdkTutorial subdirectory, not the wdkTutorial main directory.)

Create a Page
In this section, you will create the first page of the wdkTutorial application by adding a title, style sheet references, and a frameset to an existing skeletal WDK server page. If you encounter problems during the procedure, refer to the solution page wdkTutorial0_finished.jsp.

To create the page: In a plain ASCII editor, open and examine the file wdkSkeletonPage.jsp. (In the previous section, you extracted this file from an archive to your \wdkTutorial\wdkTutorial directory.) The file wdkSkeletonPage.jsp contains the basic elements that are common to most WDK server pages. For explanations of these elements, refer to Anatomy of a Typical WDK Server Page on page 2-1.

1.

2. 3.

Save the file as wdkTutorial0.jsp. To add the title, find the following line:
<title>TODO: Add title here</title>

Replace TODO: Add title here with WDK 4.2 Tutorial Application (omit the quotes). 4. To specify the style sheets, add the following two lines immediately after the title line that you edited in Step 3:

Documentum Web Development Kit Tutorial

35

Developing an Application
Create a Page

<link rel='stylesheet' type='text/css' href='/css/wdkTutorialBase.css'> <link rel='stylesheet' type='text/css' href='/css/wdkTutorial.css'>

These are the style sheets that you copied from wdkSpace sample application and renamed. They specify styles for both standard HTML elements and for the custom style classes used by the Java classes in WDK. 5. To create the frameset, add the following lines between the </head> and </ html> tags.
<frameset rows='30,*,0' border='0' framespacing='0' frameborder='no'> <frame name='header' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='no'> <frame name='view' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='auto' src='/wdkTutorial/wdk/component/browse/browse.jsp'> <frame name='actions' scrolling='no' frameborder='0'> </frameset>

This frameset contains three frames:


s An empty header frame. In a later section, you will add the toolbar in this

frame.
s A view frame that displays the WDK page browse.jsp. This page contains

two frames of its own: a frame on the left that allows you to display multiple Docbase hierarchies as a single tree, and a frame on the right that displays the contents of the cabinets and folders in a Docbase.
s An actions frame that you will use in a subsequent section. The actions

frame is not visible. 6. Save wdkTutorial0.jsp and view it in a browser. Typically its URL is http:// localhost/wdkTutorial/wdkTutorial/wdkTutorial0.jsp. The top frame is empty, and the view frame displays a Docbase tree frame on the left and a list of available docbases on the right. Your list of available Docbases will differ from the list in the illustration. Docbase browsing is not fully functional yet. If you click links in the page and log in to a Docbase, you cannot view documents correctly and you cannot log out.

36

Documentum Web Development Kit Tutorial

Developing an Application
Add the Toolbar

Add the Toolbar


In this section, you will create the page for the toolbar frame. The toolbar buttons will reside in an HTML table. You will then specify this page as the source for the header frame in the page wdkTutorial0.jsp, and save it as wdkTutorial1.jsp. If you encounter problems during the procedure, refer to the solution pages toolbarTutorial_finished.jsp and wdkTutorial1_finished.jsp.

To create the toolbar page: Open the file wdkSkeletonPage.jsp and save it as toolbarTutorial.jsp. You will edit this file to create the toolbar page. In the page import section, remove the imports of DwPageSet and DwApplication. Then add the import of DwCustToolbarInputButtonView. Your page import section is now:
<%@ page import="com.documentum.wc.env.jsp.DwJSPPageContext"%> <%@ page import="com.documentum.wc.env.DwAppSession"%> <%@ page import="com.documentum.wc.widget.DwCustToolbarInputButtonView"%>

1. 2.

DwCustToolbarInputButtonView is the class from which the toolbar buttons will be created.

Documentum Web Development Kit Tutorial

37

Developing an Application
Add the Toolbar

3.

To create the view that will generate the toolbar buttons, add the following line just before the try block:
DwCustToolbarInputButtonView custToolbarButtonView = new DwCustToolbarInputButtonView();

4.

Remove the following lines from the try block. These lines are not required by the toolbar page:
DwPageSet pageSet = wdkPageContext.getPageSet(); DwApplication app = wdkPageContext.getApplication();

5.

In the same location as the two lines that you deleted, add the following line because the toolbar page needs to connect to the current application session.
DwAppSession appSession = DwAppSession.getAppSession();

6.

In the <head> section, do the following: a. Add a title and links to the style sheets as you did in wdkTutorial0.jsp:
<title>WDK 4.2 Tutorial Application</title> <link rel='stylesheet' type='text/css' href='./css/wdkTutorialBase.css'> <link rel='stylesheet' type='text/css' href='./css/wdkTutorial.css'>

Note: In this case, include the leading dot (.) in the path names of the style sheets. b. Change the event source name from wdkTutorial0 to toolbarTutorial. c. Remove the following lines. They will not be used by the toolbar page.
<script language="JavaScript" src="/wdkTutorial/wdk/component/history/ history.js"></script> <script language="JavaScript" src="/wdkTutorial/wdkTutorial/ eventHandlers.js"></script>

7.

After the </head> tag, create the HTML body and the table that will contain the toolbar buttons:
<body class="contentBackground" topmargin="0" leftmargin="10" rightmargin="0" bottommargin="0" marginheight="0" marginwidth="0"> <table width="100%" border="0" cellpadding="0" cellspacing="0" height="30"> </table> </body>

8.
<tr>

To create the toolbar buttons, add the following row and cells to the table.

<td align=middle width="20%"> <%=custToolbarButtonView.generateEventButton("Docbase","viewDocbase", "", "")%> </td> <td align=middle width="20%"> <%=custToolbarButtonView.generateEventButton("Inbox", "viewInbox", "", "")%>

38

Documentum Web Development Kit Tutorial

Developing an Application
Add the Toolbar

</td> <td align=middle width="20%"> <%=custToolbarButtonView.generateEventButton("Logout", "logout", "", "")%> </td> </tr>

Each toolbar button is created with the method DwCustToolbarInputButtonView.generateEventButton, which takes four parameters: the button label, the event name, and two optional parameters to pass to the event. 9. Save toolbarTutorial.jsp and view it in a browser. (The URL is http:// localhost/wdkTutorial/wdkTutorial/toolbarTutorial.jsp, replacing localhost with your server name if necessary.) You see the row of toolbar buttons:

The buttons are not yet functional. You will activate them in the Add Event Handlers section.

To specify the toolbar page in the frameset of the application page: Open the file wdkTutorial0.jsp and save it as wdkTutorial1.jsp. In the JavaScript section, change the event source name from wdkTutorial0 to wdkTutorial1. Find the line that begins with <frame name='header' and add a src parameter that specifies toolbarTutorial.jsp:
<frame name='header' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='no' src='/wdkTutorial/wdkTutorial/toolbarTutorial.jsp'>

1. 2. 3.

4.

Save wdkTutorial1.jsp and view it in a browser. You see the toolbar in the header frame:

Documentum Web Development Kit Tutorial

39

Developing an Application
Add Event Handlers

Add Event Handlers


In this section, you will add event handlers to wdkTutorial1.jsp and save the page as wdkTutorial2.jsp. The new event handlers will handle the events that are fired by the toolbar buttons. If you encounter problems during the procedure, refer to the solution page wdkTutorial2_finished.jsp.

To add the event handlers: Open the file wdkTutorial1.jsp and save it as wdkTutorial2.jsp. In the JavaScript section, change the event source name from wdkTutorial1 to wdkTutorial2. At the end of the JavaScript section, add a new, empty JavaScript element:
<script language="JavaScript"> </script>

1. 2. 3.

4.

Within the new JavaScript element, add the event handler for the viewDocbase event. This event is fired by the Docbases button in the toolbar page.

310

Documentum Web Development Kit Tutorial

Developing an Application
Add Event Handlers

/** Handle viewDocbase event from Docbase button on toolbar */ function eventHandler_viewDocbase( strSender, strFolderId) { var strUrl = strContextPath + "/wdk/component/browse/browse.jsp"; strUrl = urlAddExclusiveParam(strUrl, "folderId", strFolderId); strUrl = urlMakeForcedReload(strUrl); window.frames.view.location.href = strUrl; setComponentFrame(window.frames.view.frames[1]); }

5.

Within the same JavaScript element, add the event handler for the viewInbox event. This event is fired by the Inbox button in the toolbar page.
/** Handle viewInbox event from Inbox button on toolbar */ function eventHandler_viewInbox() { var strUrl = strContextPath + "/wdk/component/inbox/inbox.jsp"; strUrl = urlMakeForcedReload( strUrl ); window.frames.view.location.href = strUrl; setComponentFrame(window.frames.view); }

6.

Within the same JavaScript element, add the event handler for the logout event. This event is fired by the Logout button in the toolbar page.
/** Handle logout event from Logout button on toolbar */ function eventHandler_logout() { var strUrl = strContextPath + "/wdk/component/logout/logout.jsp"; strUrl = urlMakeForcedReload(strUrl); window.location.href = strUrl; }

7.

Within the same JavaScript element, add the following function that ensures correct behavior when the browser window is resized in Netscape:
/** Handle resize of the browser window */ function handleResize() { if ( window.navigator.appName.toLowerCase() == "netscape" ) { window.location.reload(false); } }

8.

Add the parameters onResize and onLoad to the frameset element.


<frameset rows='30,*,0' border='0' framespacing='0' frameborder='no' onResize='handleResize()' onLoad="setComponentFrame(window.frames.view.folderDetail)">

Documentum Web Development Kit Tutorial

311

Developing an Application
Enable Actions on Docbase Contents

The onResize parameter ensures correct behavior when the browser window is resized in Netscape. The onLoad parameter ensures that WDK components (the login page, for example) are displayed in the frame on the right in the window. This is the folderDetail frame in browse.jsp, which resides in the view frame of wdkTutorial2.jsp. 9. Save wdkTutorial2.jsp and view it in a browser. Test your toolbar buttons: a. Click the Inbox button and log in when prompted. You see your Documentum Inbox. b. Click the Docbases button. You return to the Docbase view. (You cannot view Docbase content successfully if you click the links to cabinets, folders, and documents in the Docbase. You will add this functionality in the next section.) c. Click the Logout button and log out of the Docbase as prompted.

Enable Actions on Docbase Contents


In this section, you will enable actions on Docbase contents so that you can view, edit, and conduct other standard Documentum operations on the documents in a Docbase. You will start with wdkTutorial2.jsp, set up an events dictionary, load the WDK action dispatcher page into the invisible frame, and save the page as wdkTutorial3.jsp. If you encounter problems during the procedure, refer to the solution page wdkTutorial3_finished.jsp.

To enable actions on Docbase contents: Open the file wdkTutorial2.jsp and save it as wdkTutorial3.jsp. In the JavaScript section, change the event source name from wdkTutorial2 to wdkTutorial3. Add the following classes to the page import section:

1. 2. 3.

<%@ page import="com.documentum.wc.env.docbase.DwDocbaseTypedDictionary"%> <%@ page import="com.documentum.wc.widget.docbase.DwDocOpenLinkEvent"%>

You will use these classes to create a dictionary of events that are fired by links to cabinets, folders, and documents in the Docbase. These links and events allow you to browse and navigate the Docbase.

312

Documentum Web Development Kit Tutorial

Developing an Application
Extra Investigation: Use Cascading Style Sheets to Customize the Look of Your Application

4.

After the line that begins with DwApplication app, create the dictionary:

// Set up an events dictionary used for edit/view links DwDocbaseTypedDictionary eventsDictionary = (DwDocbaseTypedDictionary) app.get("Dictionary_Events"); if (eventsDictionary == null) { // Build and populate the events dictionary. eventsDictionary = new DwDocbaseTypedDictionary(); eventsDictionary.put("dm_folder", "viewFolder"); DwDocOpenLinkEvent docOpenLinkEvent = new DwDocOpenLinkEvent(); eventsDictionary.put("dm_document", docOpenLinkEvent); app.put("Dictionary_Events", eventsDictionary); } // Set up a readonly version of the events dictionary used for view links DwDocbaseTypedDictionary eventsDictionaryReadonly = (DwDocbaseTypedDictionary) app.get("Dictionary_Events_Readonly"); if (eventsDictionaryReadonly == null) { // Build and populate the readonly events dictionary. eventsDictionaryReadonly = new DwDocbaseTypedDictionary(); eventsDictionaryReadonly.put("dm_folder", "viewFolder"); DwDocOpenLinkEvent docOpenLinkEventReadonly = new DwDocOpenLinkEvent(); docOpenLinkEventReadonly.setReadOnly(true); eventsDictionaryReadonly.put("dm_document", docOpenLinkEventReadonly); app.put("Dictionary_Events_Readonly", eventsDictionaryReadonly); }

5.

Find the line that begins with <frame name='actions' and add a src parameter that specifies actionDispatcherContainer.jsp:

<frame name='actions' src='/wdkTutorial/wdk/action/actionDispatcherContainer.jsp' scrolling='no' frameborder='0'>

6.

Save wdkTutorial3.jsp and view it in a browser. To test Docbase browsing, click a Docbase name, log in, navigate to a folder, select a document, and choose View from the drop-down menu.

Extra Investigation: Use Cascading Style Sheets to Customize the Look of Your Application
Cascading Style Sheets allow you to alter the look and feel of your applications significantly without changing any code in the page. This tutorial assumes that you are familiar with Cascading Style Sheets; detailed information is available at http://www.w3.org/Style/CSS. In WDK, you can use Cascading Style Sheets to specify style property values for:
s Standard style classes such as BODY, P, and A:link. s Custom style classes that you create for your application.

Documentum Web Development Kit Tutorial

313

Developing an Application
Extra Investigation: Use Cascading Style Sheets to Customize the Look of Your Application

s Style classes that are specific to WDK. Many of the widgets and UI

elements in WDK use their own custom style classes. These WDK style classes are described in the Custom Styles section of the WDK Online Help. Your tutorial application (wdkTutorial3.jsp) uses the style sheet files that reside in the css subdirectory of the wdkTutorial directory. You can experiment by modifying the style property values in these style sheets, and you can add more styles if desired. Additionally, you can use the Branding section in the file config.xml to override WDK styles. For details, search for Branding in the WDK Online Help.

314

Documentum Web Development Kit Tutorial

Customizing WDK Components

4
4

This chapter describes two common ways to customize WDK components:


s Editing XML configuration files. s Using methods provided by WDK classes.

You will modify the document menu by editing XML files, and you will add a column to a table view using a method of the DwTableView class. This chapter contains the following sections:
s Modify a Menu on page 4-1 s Add a Column to a View on page 4-3

Modify a Menu
When you select a document in the tutorial application, you see a drop-down menu from which you can select actions to conduct on the selected document, such as Checkout, View, and Edit. You can change the items on this menu by making simple edits to the XML files in the WDK configuration folder. In this section, you will remove three items from the menu. An extra investigation section then describes how to add an item to the menu.

Before you begin


Open wdkTutorial3.jsp (or the solution file wdkTutorial3_finished.jsp). Log in to a Docbase, open a folder or cabinet in the Docbase, and select a document. Click the drop-down menu above the list of documents and examine the

Documentum Web Development Kit Tutorial

41

Customizing WDK Components


Modify a Menu

available choices. Near the bottom of the menu, you see the items Send To, Start Workflow, and Attach Document Lifecycle. In the following procedure, you will remove these three items from the menu.

Remove the menu items

To remove the three menu items: Open the wdk directory that is a sibling of the wdkTutorial directory, and then open the config directory. Make a backup copy of the file document_menus.xml, and save this backup copy in a location outside of the config directory. Return to the config directory and open the file document_menus.xml for editing. Remove the following lines from the file. These are the lines that correspond to the three menu items that you want to remove:
<menuitem> <name><nlsid>MSG_SENDTO_MENU</nlsid></name> <actionid>sendTo</actionid> </menuitem> <menuitem> <name><nlsid>MSG_STARTWORKFLOW_MENU</nlsid></name> <actionid>startWorkflow</actionid> </menuitem> <menuitem> <name><nlsid>MSG_ATTACH_POLICY_MENU</nlsid></name> <actionid>attachPolicy</actionid> <disableifmultipleselections/> </menuitem>

1.

2. 3.

4. 5.

Save document_menus.xml. Restart your application server to activate the changes to the XML file. Once again, open wdkTutorial3.jsp (or the solution file wdkTutorial3_finished.jsp). Log in to a Docbase, open a folder or cabinet in the Docbase, and select a document. Click the drop-down menu above the list of documents and examine the available choices. You no longer see the items Send To, Start Workflow, and Attach Document Lifecycle.

42

Documentum Web Development Kit Tutorial

Customizing WDK Components


Add a Column to a View

Extra investigation: Add a menu item


In the config folder, the files document_actions.xml and document_menus.xml work together to configure the available menu items and the corresponding actions that they perform when a document is selected:
s document_actions.xml specifies the possible actions to perform on a

document.
s document_menus.xml specifies the menu items that are available when a

document is selected, and the corresponding action to perform. The actionid values in document_menus.xml correspond to the id values in document_actions.xml. To add a new action and a corresponding new menu item, specify the new action in document_actions.xml, and then specify the new menu item in document_actions.xml. For detailed information on actions and menus, see the WDK Online Help.

Add a Column to a View


To display a list of documents in a cabinet or folder, the server pages in WDK use the class DwTableView. DwTableView provides methods that allow you to specify the columns that are displayed in the table. In this section, you will use a method of DwTableView to add a column that displays the object type.

Before you begin


Open wdkTutorial3.jsp (or the solution file wdkTutorial3_finished.jsp). Log in to a Docbase and open a folder or cabinet in the Docbase. In the table of documents, you see the columns Name, Last Modified, and Lock Owner. In the following procedure, you will add a column named Type that displays the object type. Important! For simplicity and clarity, the following exercise asks you to edit the WDK server page folderContents.jsp. This is contrary to the recommended best practices to follow when you develop your own WDK-

Documentum Web Development Kit Tutorial

43

Customizing WDK Components


Add a Column to a View

powered web applications. When you develop your own applications, put custom functionality solely in custom server pages. Edit the WDK server pages solely to call your custom pages. If you edit the WDK server pages directly, the resulting pages can be difficult to migrate to future versions of WDK.

Add the column to the view


If you encounter problems during this procedure, refer to the solution page folderContents.jsp.

To add the Type column to the view: Open the wdk directory below the main wdkTutorial directory, open the component subdirectory, and then open the contents subdirectory. Make a backup copy of the file folderContents.jsp. Open folderContents.jsp for editing. Locate the following line:
<jsp:useBean id="folderContentsView" class="com.documentum.wc.widget.DwTableView" scope="session" />

1.

2. 3.

This line creates folderContentsView, which is a table view bean based on the class DwTableView. The next three lines set the model to use with the view (the model was created earlier on the page), specify how to align the rows, and whether to display row dividers. The subsequent set of statements specifies the columns in folderContentsView. In the next step, you will add a line that specifies the new Type column. 4. Between the lines for Name and Modification Date, insert the following line:
folderContentsView.addFormattedColumn("Type", "Type", strObjType, "15%");

5. 6.

In the line that specifies the Name column, change 55% to 40%. Add a line that obtains values for strObjType: a. Scroll up to the section with the comment Define useful format strings. b. Add the following line:
String strObjType = "{r_object_type}";

44

Documentum Web Development Kit Tutorial

Customizing WDK Components


Add a Column to a View

7.

Save folderContents.jsp. Once again, open wdkTutorial3.jsp (or the solution file wdkTutorial3_finished.jsp). Log in to a Docbase and open a folder or cabinet in the Docbase. In the table of documents, you now see the new Type column that displays the object type of each document.

Documentum Web Development Kit Tutorial

45

Customizing WDK Components


Add a Column to a View

46

Documentum Web Development Kit Tutorial

Displaying Properties of a Custom Object Type

5
5

This chapter describes how to display the properties of a custom object type in the properties page of the WDK. It contains the following sections:
s Display Custom Properties of a Custom Object Type on page 5-1 s Extra Investigation: Searching for Properties of a Custom Object Type on

page 5-3 This chapter assumes that your Docbase already contains a custom object type with custom properties. Typically you use Documentum Developer Studio to create custom types and properties.

Display Custom Properties of a Custom Object Type


In WDK, when you display the properties of a selected document from the Docbase, you see the values for a default set of properties for the generic object type dm_document. If the document is of a custom object type, you do not see values for any of the custom properties that are associated with the custom object type. To display values for the properties of a custom object type, you must create a new XML configuration file that specifies the custom object type and the custom properties to display. In this section, you will create a new XML configuration file for a custom document type in your Docbase. You can use any custom object type that resides in your Docbase.

Documentum Web Development Kit Tutorial

51

Displaying Properties of a Custom Object Type


Display Custom Properties of a Custom Object Type

Before you begin


Collect the following information for the custom object type that you want to use in the procedure:
s The name of the object type. s The names two editable properties to display.

Open wdkTutorial3.jsp (or the solution file wdkTutorial3_finished.jsp). Log in to a Docbase and open a folder or cabinet in the Docbase that contains a document of your custom type. Select the document, and then choose Properties from the menu. You see properties for the dm_document type, but you do not see any of the properties of your custom type.

Display the custom properties

To display the custom properties in the properties page: Open the wdk directory that is a sibling of the wdkTutorial directory, and then open the config directory. Make a copy of the file document_properties.xml and name it customtype_properties.xml. (The name does not matter, but the extension must be .xml.) Open customtype_properties.xml for editing. Change the value of <type> from dm_document to the name of your custom type. Examine the section <attributes><editablegroups><group><attributelist>. You see that five attributes are specified by default: object_name, title, subject, keywords, and authors. In the next step, you will add your two custom properties to this list. Following the format of the five existing attribute elements, add two more attribute elements that specify the two custom properties that you want to display. Notes:
s Omit the <nlsid> element within <label>, and specify the label directly.

1.

2. 3. 4.

5.

This is the label to display next to the value of the property in the properties page. For example, the label for a property named platform might be:
<label>Platform</label>

52

Documentum Web Development Kit Tutorial

Displaying Properties of a Custom Object Type


Extra Investigation: Searching for Properties of a Custom Object Type

s For properties that have repeating values, use <showallvalues> to specify

whether to display all values.


s To display repeating values in a drop-down select box, use:
<displaycontrol>select</displaycontrol>

6. 7.

Save customtype_properties.xml. Restart your application server to activate the changes to the XML file. Once again, open wdkTutorial3.jsp (or the solution file wdkTutorial3_finished.jsp). Log in to a Docbase and open a folder or cabinet in the Docbase that contains a document of your custom type. Select the document, and then choose Properties from the menu. You now see the values of properties of your custom type.

Extra Investigation: Searching for Properties of a Custom Object Type


By default, the search page in WDK does not provide the ability to search properties of custom object types. To search properties of custom types, modify the configuration file advanced_search.xml to include your custom type and properties. This process is similar to the procedure that you just completed. To use advanced_search.xml, your application must have search functionality. The tutorial application does not include search functionality. However, you can use the wdkSpace sample application, which does provide searching. For detailed information, see the topic Custom Search Forms in the WDK Online Help.

Documentum Web Development Kit Tutorial

53

Displaying Properties of a Custom Object Type


Extra Investigation: Searching for Properties of a Custom Object Type

54

Documentum Web Development Kit Tutorial

Solution Code

A
A

This chapter contains listings of the following completed files that are used in this tutorial. The files are listed in the order in which they are used in the tutorial procedures.
s wdkSkeletonPage.jsp on page A-2 s wdkTutorial0_finished.jsp on page A-3 s wdkTutorial1_finished.jsp on page A-4 s toolbarTutorial_finished.jsp on page A-5 s wdkTutorial2_finished.jsp on page A-7 s wdkTutorial3_finished.jsp on page A-9 s folderContents.jsp on page A-11

Documentum Web Development Kit Tutorial

A1

Solution Code
wdkSkeletonPage.jsp

wdkSkeletonPage.jsp
<%@ page contentType="text/html; charset=UTF-8" %> <%@ page language="java" errorPage="/wdk/component/error/error.jsp"%> <%@ page info="WDK 4.2 Tutorial Application" %> <%@ <%@ <%@ <%@ <% // Establish the context for this page. DwJSPPageContext wdkPageContext = new DwJSPPageContext(pageContext.getServletContext(), request, response, true); try { DwPageSet pageSet = wdkPageContext.getPageSet(); DwApplication app = wdkPageContext.getApplication(); String strContextPath = request.getContextPath(); %> <html> <head> <title>TODO: Add title here</title> <script language="JavaScript"> var strContextPath = "/wdkTutorial";</script> <script language="JavaScript" src="../wdk/env/events.js"></script> <script language="JavaScript">setEventSourceName("wdkTutorial0")</script> <script language="JavaScript" src="../wdk/env/url.js"></script> <script language="JavaScript" src="../wdk/env/urlArguments.js"></script> <script language="JavaScript" src="../wdk/component/history/history.js"></script> <script language="JavaScript" src="../wdkTutorial/eventHandlers.js"></script> </head> </html> <% // Release the lock on the page. wdkPageContext.releaseSession(); } catch(Exception err) { // Release the lock on the page. wdkPageContext.releaseSession(); request.setAttribute ("ErrorDescription", "Tutorial application failed."); throw err; } %> page page page page import="com.documentum.wc.env.jsp.DwJSPPageContext"%> import="com.documentum.wc.env.DwPageSet"%> import="com.documentum.wc.env.DwAppSession"%> import="com.documentum.wc.env.DwApplication"%>

A2

Documentum Web Development Kit Tutorial

Solution Code
wdkTutorial0_finished.jsp

wdkTutorial0_finished.jsp
<%@ page contentType="text/html; charset=UTF-8" %> <%@ page language="java" errorPage="/wdk/component/error/error.jsp"%> <%@ page info="WDK 4.2 Tutorial Application" %> <%@ <%@ <%@ <%@ <% // Establish the context for this page. DwJSPPageContext wdkPageContext = new DwJSPPageContext(pageContext.getServletContext(), request, response, true); try { DwPageSet pageSet = wdkPageContext.getPageSet(); DwApplication app = wdkPageContext.getApplication(); String strContextPath = request.getContextPath(); %> <html> <head> <title>WDK 4.2 Tutorial Application</title> <link rel='stylesheet' type='text/css' href='/css/wdkTutorialBase.css'> <link rel='stylesheet' type='text/css' href='/css/wdkTutorial.css'> <script language="JavaScript"> var strContextPath = "/wdkTutorial";</script> <script language="JavaScript" src="../wdk/env/events.js"></script> <script language="JavaScript">setEventSourceName("wdkTutorial0")</script> <script <script <script <script </head> <frameset rows='30,*,0' border='0' framespacing='0' frameborder='no'> <frame name='header' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='no'> <frame name='view' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='auto' src='/wdkTutorial/wdk/component/browse/browse.jsp'> <frame name='actions' scrolling='no' frameborder='0'> </frameset> </html> <% // Release the lock on the page. wdkPageContext.releaseSession(); } catch(Exception err) { // Release the lock on the page. wdkPageContext.releaseSession(); request.setAttribute ("ErrorDescription", "Tutorial application failed."); throw err; } %> language="JavaScript" language="JavaScript" language="JavaScript" language="JavaScript" src="../wdk/env/url.js"></script> src="../wdk/env/urlArguments.js"></script> src="../wdk/component/history/history.js"></script> src="../wdkTutorial/eventHandlers.js"></script> page page page page import="com.documentum.wc.env.jsp.DwJSPPageContext"%> import="com.documentum.wc.env.DwPageSet"%> import="com.documentum.wc.env.DwAppSession"%> import="com.documentum.wc.env.DwApplication"%>

Documentum Web Development Kit Tutorial

A3

Solution Code
wdkTutorial1_finished.jsp

wdkTutorial1_finished.jsp
<%@ page contentType="text/html; charset=UTF-8" %> <%@ page language="java" errorPage="/wdk/component/error/error.jsp"%> <%@ page info="WDK 4.2 Tutorial Application" %> <%@ <%@ <%@ <%@ <% // Establish the context for this page. DwJSPPageContext wdkPageContext = new DwJSPPageContext(pageContext.getServletContext(), request, response, true); try { DwPageSet pageSet = wdkPageContext.getPageSet(); DwApplication app = wdkPageContext.getApplication(); String strContextPath = request.getContextPath(); %> <html> <head> <title>WDK 4.2 Tutorial Application</title> <link rel='stylesheet' type='text/css' href='/css/wdkTutorialBase.css'> <link rel='stylesheet' type='text/css' href='/css/wdkTutorial.css'> <script language="JavaScript"> var strContextPath = "/wdkTutorial";</script> <script language="JavaScript" src="../wdk/env/events.js"></script> <script language="JavaScript">setEventSourceName("wdkTutorial1")</script> <script <script <script <script </head> <frameset rows='30,*,0' border='0' framespacing='0' frameborder='no'> <frame name='header' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='no' src='/wdkTutorial/wdkTutorial/toolbarTutorial_finished.jsp'> <frame name='view' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='auto' src='/wdkTutorial/wdk/component/browse/browse.jsp'> <frame name='actions' scrolling='no' frameborder='0'> </frameset> </html> <% // Release the lock on the page. wdkPageContext.releaseSession(); } catch(Exception err) { // Release the lock on the page. wdkPageContext.releaseSession(); request.setAttribute ("ErrorDescription", "Tutorial application failed."); throw err; } %> language="JavaScript" language="JavaScript" language="JavaScript" language="JavaScript" src="../wdk/env/url.js"></script> src="../wdk/env/urlArguments.js"></script> src="../wdk/component/history/history.js"></script> src="../wdkTutorial/eventHandlers.js"></script> page page page page import="com.documentum.wc.env.jsp.DwJSPPageContext"%> import="com.documentum.wc.env.DwPageSet"%> import="com.documentum.wc.env.DwAppSession"%> import="com.documentum.wc.env.DwApplication"%>

A4

Documentum Web Development Kit Tutorial

Solution Code
toolbarTutorial_finished.jsp

toolbarTutorial_finished.jsp
<%@ page contentType="text/html; charset=UTF-8" %> <%@ page language="java" errorPage="/wdk/component/error/error.jsp"%> <%@ page info="WDK 4.2 Tutorial Application" %> <%@ page import="com.documentum.wc.env.jsp.DwJSPPageContext"%> <%@ page import="com.documentum.wc.env.DwAppSession"%> <%@ page import="com.documentum.wc.widget.DwCustToolbarInputButtonView"%> <% // Establish the context for this page. DwJSPPageContext wdkPageContext = new DwJSPPageContext(pageContext.getServletContext(), request, response, true); DwCustToolbarInputButtonView custToolbarButtonView = new DwCustToolbarInputButtonView(); try { DwAppSession appSession = DwAppSession.getAppSession(); String strContextPath = request.getContextPath(); %> <html> <head> <title>WDK 4.2 Tutorial Application</title> <link rel='stylesheet' type='text/css' href='./css/wdkTutorialBase.css'> <link rel='stylesheet' type='text/css' href='./css/wdkTutorial.css'> <script language="JavaScript"> var strContextPath = "/wdkTutorial";</script> <script language="JavaScript" src="../wdk/env/events.js"></script> <script language="JavaScript">setEventSourceName("toolbarTutorial")</script> <script language="JavaScript" src="../wdk/env/url.js"></script> <script language="JavaScript" src="../wdk/env/urlArguments.js"></script> </head> <body class="contentBackground" topmargin="0" leftmargin="10" rightmargin="0" bottommargin="0" marginheight="0" marginwidth="0"> <table width="100%" border="0" cellpadding="0" cellspacing="0" height="30"> <tr> <td align=middle width="20%"> <%=custToolbarButtonView.generateEventButton("Docbase","viewDocbase", "", "")%> </td> <td align=middle width="20%"> <%=custToolbarButtonView.generateEventButton("Inbox", "viewInbox", "", "")%> </td> <td align=middle width="20%"> <%=custToolbarButtonView.generateEventButton("Logout", "logout", "", "")%> </td> </tr> </table> </body> </html> <% // Release the lock on the page. wdkPageContext.releaseSession(); } catch(Exception err) { // Release the lock on the page. wdkPageContext.releaseSession(); request.setAttribute ("ErrorDescription", "Tutorial application failed.");

Documentum Web Development Kit Tutorial

A5

Solution Code
toolbarTutorial_finished.jsp

throw err; } %>

A6

Documentum Web Development Kit Tutorial

Solution Code
wdkTutorial2_finished.jsp

wdkTutorial2_finished.jsp
<%@ page contentType="text/html; charset=UTF-8" %> <%@ page language="java" errorPage="/wdk/component/error/error.jsp"%> <%@ page info="WDK 4.2 Tutorial Application" %> <%@ <%@ <%@ <%@ <% // Establish the context for this page. DwJSPPageContext wdkPageContext = new DwJSPPageContext(pageContext.getServletContext(), request, response, true); try { DwPageSet pageSet = wdkPageContext.getPageSet(); DwApplication app = wdkPageContext.getApplication(); String strContextPath = request.getContextPath(); %> <html> <head> <title>WDK 4.2 Tutorial Application</title> <link rel='stylesheet' type='text/css' href='/css/wdkTutorialBase.css'> <link rel='stylesheet' type='text/css' href='/css/wdkTutorial.css'> <script language="JavaScript"> var strContextPath = "/wdkTutorial";</script> <script language="JavaScript" src="../wdk/env/events.js"></script> <script language="JavaScript">setEventSourceName("wdkTutorial2")</script> <script <script <script <script language="JavaScript" language="JavaScript" language="JavaScript" language="JavaScript" src="../wdk/env/url.js"></script> src="../wdk/env/urlArguments.js"></script> src="../wdk/component/history/history.js"></script> src="../wdkTutorial/eventHandlers.js"></script> page page page page import="com.documentum.wc.env.jsp.DwJSPPageContext"%> import="com.documentum.wc.env.DwPageSet"%> import="com.documentum.wc.env.DwAppSession"%> import="com.documentum.wc.env.DwApplication"%>

<script language="JavaScript"> /** Handle viewDocbase event from Docbase button on toolbar */ function eventHandler_viewDocbase( strSender, strFolderId) { var strUrl = strContextPath + "/wdk/component/browse/browse.jsp"; strUrl = urlAddExclusiveParam(strUrl, "folderId", strFolderId); strUrl = urlMakeForcedReload(strUrl); window.frames.view.location.href = strUrl; setComponentFrame(window.frames.view.frames[1]); } /** Handle viewInbox event from Inbox button on toolbar */ function eventHandler_viewInbox() { var strUrl = strContextPath + "/wdk/component/inbox/inbox.jsp"; strUrl = urlMakeForcedReload( strUrl ); window.frames.view.location.href = strUrl; setComponentFrame(window.frames.view); } /** Handle logout event from Logout button on toolbar */ function eventHandler_logout() {

Documentum Web Development Kit Tutorial

A7

Solution Code
wdkTutorial2_finished.jsp

var strUrl = strContextPath + "/wdk/component/logout/logout.jsp"; strUrl = urlMakeForcedReload(strUrl); window.location.href = strUrl; } /** Handle resize of the browser window */ function handleResize() { if ( window.navigator.appName.toLowerCase() == "netscape" ) { window.location.reload(false); } } </script> </head> <frameset rows='30,*,0' border='0' framespacing='0' frameborder='no' onResize='handleResize()' onLoad="setComponentFrame(window.frames.view.folderDetail)"> <frame name='header' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='no' src='/wdkTutorial/wdkTutorial/toolbarTutorial_finished.jsp'> <frame name='view' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='auto' src='/wdkTutorial/wdk/component/browse/browse.jsp'> <frame name='actions' scrolling='no' frameborder='0'> </frameset> </html> <% // Release the lock on the page. wdkPageContext.releaseSession(); } catch(Exception err) { // Release the lock on the page. wdkPageContext.releaseSession(); request.setAttribute ("ErrorDescription", "Tutorial application failed."); throw err; } %>

A8

Documentum Web Development Kit Tutorial

Solution Code
wdkTutorial3_finished.jsp

wdkTutorial3_finished.jsp
<%@ page contentType="text/html; charset=UTF-8" %> <%@ page language="java" errorPage="/wdk/component/error/error.jsp"%> <%@ page info="WDK 4.2 Tutorial Application" %> <%@ <%@ <%@ <%@ <%@ <%@ <% // Establish the context for this page. DwJSPPageContext wdkPageContext = new DwJSPPageContext(pageContext.getServletContext(), request, response, true); try { DwPageSet pageSet = wdkPageContext.getPageSet(); DwApplication app = wdkPageContext.getApplication(); // Set up an events dictionary used for edit/view links DwDocbaseTypedDictionary eventsDictionary = (DwDocbaseTypedDictionary) app.get("Dictionary_Events"); if (eventsDictionary == null) { // Build and populate the events dictionary. eventsDictionary = new DwDocbaseTypedDictionary(); eventsDictionary.put("dm_folder", "viewFolder"); DwDocOpenLinkEvent docOpenLinkEvent = new DwDocOpenLinkEvent(); eventsDictionary.put("dm_document", docOpenLinkEvent); app.put("Dictionary_Events", eventsDictionary); } // Set up a readonly version of the events dictionary used for view links DwDocbaseTypedDictionary eventsDictionaryReadonly = (DwDocbaseTypedDictionary)app.get("Dictionary_Events_Readonly"); if (eventsDictionaryReadonly == null) { // Build and populate the readonly events dictionary. eventsDictionaryReadonly = new DwDocbaseTypedDictionary(); eventsDictionaryReadonly.put("dm_folder", "viewFolder"); DwDocOpenLinkEvent docOpenLinkEventReadonly = new DwDocOpenLinkEvent(); docOpenLinkEventReadonly.setReadOnly(true); eventsDictionaryReadonly.put("dm_document", docOpenLinkEventReadonly); app.put("Dictionary_Events_Readonly", eventsDictionaryReadonly); } String strContextPath = request.getContextPath(); %> <html> <head> <title>WDK 4.2 Tutorial Application</title> <link rel='stylesheet' type='text/css' href='/css/wdkTutorialBase.css'> <link rel='stylesheet' type='text/css' href='/css/wdkTutorial.css'> <script language="JavaScript"> var strContextPath = "/wdkTutorial";</script> <script language="JavaScript" src="../wdk/env/events.js"></script> <script language="JavaScript">setEventSourceName("wdkTutorial3")</script> page page page page page page import="com.documentum.wc.env.jsp.DwJSPPageContext"%> import="com.documentum.wc.env.DwPageSet"%> import="com.documentum.wc.env.DwAppSession"%> import="com.documentum.wc.env.DwApplication"%> import="com.documentum.wc.env.docbase.DwDocbaseTypedDictionary"%> import="com.documentum.wc.widget.docbase.DwDocOpenLinkEvent"%>

Documentum Web Development Kit Tutorial

A9

Solution Code
wdkTutorial3_finished.jsp

<script <script <script <script

language="JavaScript" language="JavaScript" language="JavaScript" language="JavaScript"

src="../wdk/env/url.js"></script> src="../wdk/env/urlArguments.js"></script> src="../wdk/component/history/history.js"></script> src="../wdkTutorial/eventHandlers.js"></script>

<script language="JavaScript"> /** Handle viewDocbase event from Docbase button on toolbar */ function eventHandler_viewDocbase( strSender, strFolderId) { var strUrl = strContextPath + "/wdk/component/browse/browse.jsp"; strUrl = urlAddExclusiveParam(strUrl, "folderId", strFolderId); strUrl = urlMakeForcedReload(strUrl); window.frames.view.location.href = strUrl; setComponentFrame(window.frames.view.frames[1]); } /** Handle viewInbox event from Inbox button on toolbar */ function eventHandler_viewInbox() { var strUrl = strContextPath + "/wdk/component/inbox/inbox.jsp"; strUrl = urlMakeForcedReload( strUrl ); window.frames.view.location.href = strUrl; setComponentFrame(window.frames.view); } /** Handle logout event from Logout button on toolbar */ function eventHandler_logout() { var strUrl = strContextPath + "/wdk/component/logout/logout.jsp"; strUrl = urlMakeForcedReload(strUrl); window.location.href = strUrl; } /** Handle resize of the browser window */ function handleResize() { if ( window.navigator.appName.toLowerCase() == "netscape" ) { window.location.reload(false); } } </script> </head> <frameset rows='30,*,0' border='0' framespacing='0' frameborder='no' onResize='handleResize()' onLoad="setComponentFrame(window.frames.view.folderDetail)"> <frame name='header' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='no' src='/wdkTutorial/wdkTutorial/toolbarTutorial_finished.jsp'> <frame name='view' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='auto' src='/wdkTutorial/wdk/component/browse/browse.jsp'> <frame name='actions' src='/wdkTutorial/wdk/action/actionDispatcherContainer.jsp' scrolling='no' frameborder='0'> </frameset> </html> <% // Release the lock on the page. wdkPageContext.releaseSession(); } catch(Exception err) { // Release the lock on the page. wdkPageContext.releaseSession(); request.setAttribute ("ErrorDescription", "Tutorial application failed."); throw err; } %>

A10

Documentum Web Development Kit Tutorial

Solution Code
folderContents.jsp

folderContents.jsp
<%@ page contentType="text/html; charset=UTF-8" %> <%@ page language="java" errorPage="/wdk/component/error/error.jsp"%> <%@ page info="Documentum Web Development Kit 4.2" %> <% //***************************************************************************** //*(c) Copyright Documentum, Inc. 2000-2001. All rights reserved. //* May not be used without prior written agreement signed //* by a Documentum corporate officer. //***************************************************************************** //* Project: WDK //* File: folderContents.jsp //* Description: //* //* This page contains event handlers to update the folder header and folder //* body. //* //* Optional Request Parameters //* ------------------//* objectId Object ID of the folder to display contents //* currentpos Current viewing position of the folder contents. Defaults is 1 //* pagesize Number of objects to display per page. Defaults to 10 //***************************************************************************** %> <%@ page import="java.util.Vector"%> <%@ <%@ <%@ <%@ <%@ <%@ <%@ <%@ <%@ <%@ <%@ <%@ <%@ <%@ page page page page page page page page page page page page page page import="com.documentum.fc.client.IDfClient"%> import="com.documentum.fc.client.DfClient"%> import="com.documentum.fc.common.IDfId"%> import="com.documentum.fc.common.DfId"%> import="com.documentum.wc.env.DwApplication"%> import="com.documentum.wc.env.DwAppSession"%> import="com.documentum.wc.env.jsp.DwJSPPageContext"%> import="com.documentum.wc.env.DwPageSet"%> import="com.documentum.wc.env.docbase.DwDocbaseTypedDictionary"%> import="com.documentum.wc.widget.DwTableView"%> import="com.documentum.wc.widget.docbase.DwFolderContentListModel"%> import="com.documentum.wc.widget.docbase.DwObjectNameCellRenderer"%> import="com.documentum.wc.widget.docbase.DwIconCellRenderer"%> import="com.documentum.wc.widget.docbase.DwObjectSelectCellRenderer"%>

<%@ page import="com.documentum.wc.nls.DwNLSwdkComponentContents"%> <%@ page import="com.documentum.wc.nls.DwNLSDateFormats"%> <%@ page import="com.documentum.wc.util.IDwStyleSheetConstants"%> <% // Establish the context for this page. DwJSPPageContext wdkPageContext = new DwJSPPageContext(pageContext.getServletContext(), request, response, true); // Get lookup object DwNLSwdkComponentContents lookup = new DwNLSwdkComponentContents(); DwNLSDateFormats dfLookup = new DwNLSDateFormats(); try { // Establish context. DwPageSet pageSet = wdkPageContext.getPageSet(); // Parse URL arguments. String objectId = request.getParameter("objectId"); String strPageSize = "10"; String strCurrentPos = "0";

Documentum Web Development Kit Tutorial

A11

Solution Code
folderContents.jsp

String strHasNextPage = "false"; String strHasPreviousPage = "false"; int nTotalItems = 0; String strDocbaseName = ""; String strUser = ""; if((objectId != null) &&(objectId.length() > 0)) { IDfClient client = DfClient.getLocalClient(); IDfId idobj = new DfId(objectId); strDocbaseName = client.getDocbaseNameFromId(idobj); // Set the current docbase DwAppSession appSession = wdkPageContext.acquireSession(strDocbaseName); if (appSession == null) return; DwPageSet appPageSet = wdkPageContext.getPageSet(); // get user name for this docbase strUser = appSession.getDocbaseSession().getDfSession().getLoginUserName(); // create a folder contents model(create it every time) DwFolderContentListModel folderContentsModel =(DwFolderContentListModel)pageSet.create("folderContentsModel", DwFolderContentListModel.class.getName()); folderContentsModel.setFolderId(objectId); // create a list to keep track of multiple selections(list of object id strings) Vector multipleSelectionList =(Vector) pageSet.create("multipleSelectionList", Vector.class.getName()); // get number of folder content items. nTotalItems = folderContentsModel.getCountOfItemsInFolder(); // get the current viewing position in the folder contents int nCurrentPos = -1; strCurrentPos = request.getParameter("currentpos"); if(strCurrentPos != null && strCurrentPos.length() > 0) { nCurrentPos = Integer.parseInt(strCurrentPos); } else { strCurrentPos = "1"; nCurrentPos = 1; } // if there are no folder content items display the current position as 0. if(nTotalItems == 0) { strCurrentPos = "0"; nCurrentPos = 0; } // determine the page size to use, 10 by default. strPageSize = request.getParameter("pagesize"); if(strPageSize == null || strPageSize.length() == 0) { strPageSize =(String) pageSet.get("selectedSize"); if(strPageSize == null || strPageSize.length() == 0) { strPageSize = "10"; } } int nPageSize = Integer.parseInt(strPageSize); // save the page size setting. pageSet.put("selectedSize", strPageSize); folderContentsModel.setPageSize(nPageSize);

A12

Documentum Web Development Kit Tutorial

Solution Code
folderContents.jsp

if(nPageSize >= nTotalItems) { strCurrentPos = "1"; nCurrentPos = 1; } // set the current position in the folder contents model folderContentsModel.setCurrentPosition(nCurrentPos); // find out if there are next and previous pages. boolean fHasNextPage = folderContentsModel.hasNextPage(); if(fHasNextPage) { strHasNextPage = "true"; } boolean fHasPreviousPage = folderContentsModel.hasPreviousPage(); if(fHasPreviousPage) { strHasPreviousPage = "true"; } // Define useful format strings String strLockIcon = "{LockIcon(Property(r_lock_owner))}"; String strIcon = "{Icon(Property(r_object_id),Property(r_object_type),Property(a_content_type),16,closed,Property(r_i s_virtual_doc),Property(r_link_cnt),Property(r_assembled_from_id),Property(r_has_frzn_assembly))}"; String strModifiedDate = "{Date(Property(r_modify_date), '"+dfLookup.getString(DwNLSDateFormats.DF_BASIC_DAY_MONTH_YEAR)+"')}"; String strLockedBy = "{r_lock_owner}"; String strObjType = "{r_object_type}"; // define the object selection column (checkboxes) DwObjectSelectCellRenderer objectSelectRenderer = new DwObjectSelectCellRenderer(); objectSelectRenderer.setEvent("objectSelectedInFolderBody"); objectSelectRenderer.setEnableMultipleSelect(true); // Define the selectable icon column DwIconCellRenderer iconRenderer = new DwIconCellRenderer(); iconRenderer.setEventDictionary( (DwDocbaseTypedDictionary) appPageSet.get ( "Dictionary_Events" ) ); iconRenderer.setIcon(strIcon); // Define the name column DwObjectNameCellRenderer nameRenderer = new DwObjectNameCellRenderer(); nameRenderer.setEventDictionary( (DwDocbaseTypedDictionary) appPageSet.get ( "Dictionary_Events" ) ); nameRenderer.setShowFormat(true); nameRenderer.setShowSubject(true); // create a table view for the contents (create it every time but store in session scope // for folderColumnHeaders and folderbody frames) if ( pageContext.getAttribute("folderContentsView", PageContext.SESSION_SCOPE) != null ) { session.removeAttribute("folderContentsView"); } %> <jsp:useBean id="folderContentsView" class="com.documentum.wc.widget.DwTableView" scope="session" /> <jsp:setProperty name="folderContentsView" property="model" value="<%= folderContentsModel %>" /> <jsp:setProperty name="folderContentsView" property="rowAlignment" value="<%= DwTableView.ROW_ALIGN_MIDDLE %>" /> <jsp:setProperty name="folderContentsView" property="rowDividerVisibility" value="true" /> <% folderContentsView.addRenderedColumn("objectSelect", objectSelectRenderer, "5%"); folderContentsView.addFormattedColumn("LockIcon", "", strLockIcon, "5%"); folderContentsView.addRenderedColumn("Icon", iconRenderer, "5%"); folderContentsView.addRenderedColumn("Name", lookup.getString(DwNLSwdkComponentContents.MSG_NAME), nameRenderer, "40%"); folderContentsView.addFormattedColumn("Type", "Type", strObjType, "15%"); folderContentsView.addFormattedColumn("ModificationDate", lookup.getString(DwNLSwdkComponentContents.MSG_LAST_MODIFIED), strModifiedDate, "15%");

Documentum Web Development Kit Tutorial

A13

Solution Code
folderContents.jsp

folderContentsView.addFormattedColumn("LockOwner", lookup.getString(DwNLSwdkComponentContents.MSG_LOCK_OWNER), strLockedBy, "15%"); } String strContextPath = request.getContextPath(); // url to reload this page String strFolderContentsUrl = strContextPath + "/wdk/component/contents/folderContents.jsp"; // url to folderPrevNext String strPrevNextUrl = pageSet.makeUrl(strContextPath + "/wdk/component/contents/ folderPrevNext.jsp?currentpos=" + strCurrentPos + "&totalnumitems=" + nTotalItems + "&hasnextpage=" + strHasNextPage + "&haspreviouspage=" + strHasPreviousPage); // Unlock the page wdkPageContext.releaseSession(); %> <html> <head> <!--************************************************************************--> <!--*(c) Copyright Documentum, Inc. 2000-2001. All rights reserved. --> <!--* May not be used without prior written agreement signed --> <!--* by a Documentum corporate officer. --> <!--************************************************************************--> <title><%=lookup.getString(DwNLSwdkComponentContents.MSG_FOLDER_CONTENTS)%></title> <link rel='stylesheet' type='text/css' href='<%=strContextPath + "/" + DwApplication.getApplication().getStyleSheet("Branding.StyleSheets.Framework", IDwStyleSheetConstants.STYLE_BASIC)%>'> <script language="JavaScript" src="<%= strContextPath %>/wdk/env/events.js"></script> <script language="JavaScript">setEventSourceName("folderContents")</script> <script language="JavaScript" src="<%= strContextPath %>/wdk/env/url.js"></script> <script language="JavaScript"> /** * Handle an object selection in the folder header * * @param strSelectedObjectId the object id of the selected object */ function eventHandler_objectSelectedInFolderHeader(sender, strSelectedObjectId) { // update folder body in case it previously had an object selection var strUrl = '<%=pageSet.makeUrl(strContextPath + "/wdk/component/contents/ folderBody.jsp")%>'; strUrl = urlAddExclusiveParam(strUrl, "objectId", "<%=objectId%>"); strUrl = urlAddExclusiveParam(strUrl, "pagesize", "<%=strPageSize%>"); strUrl = urlAddExclusiveParam(strUrl, "currentpos", "<%=strCurrentPos%>"); strUrl = urlMakeForcedReload(strUrl); window.body.location.replace(strUrl); // update menu area with menu for selected object var strUrl2 = '<%=pageSet.makeUrl(strContextPath + "/wdk/component/contents/ folderHeader.jsp")%>'; strUrl2 = urlAddExclusiveParam(strUrl2, "folderId", "<%=objectId%>"); strUrl2 = urlAddExclusiveParam(strUrl2, "menuObjectId", strSelectedObjectId); strUrl2 = urlMakeForcedReload(strUrl2); window.header.location.replace(strUrl2); } /** * Handle an object selection in the folder body * * @param strSelectedObjectId the object id of the selected object */ function eventHandler_objectSelectedInFolderBody(sender, strSelectedObjectId) { // update folder header in case it previously had an folder object selection // update menu area with menu for selected object var strUrl = '<%=pageSet.makeUrl(strContextPath + "/wdk/component/contents/ folderHeader.jsp")%>'; strUrl = urlAddExclusiveParam(strUrl, "folderId", "<%=objectId%>"); strUrl = urlAddExclusiveParam(strUrl, "menuObjectId", strSelectedObjectId); strUrl = urlMakeForcedReload(strUrl); window.header.location.replace(strUrl);

A14

Documentum Web Development Kit Tutorial

Solution Code
folderContents.jsp

} /** * Handle change in the page size to show at one time * * @param strPageSize new page size */ function eventHandler_pageSize(sender, strPageSize) { // reload folder contents frame set with new page size var strUrl = "<%=pageSet.makeUrl(strFolderContentsUrl)%>"; strUrl = urlAddExclusiveParam(strUrl, "objectId", "<%=objectId%>"); strUrl = urlAddExclusiveParam(strUrl, "currentpos", "<%=strCurrentPos%>"); strUrl = urlAddExclusiveParam(strUrl, "pagesize", strPageSize); strUrl = urlMakeForcedReload(strUrl); window.location.replace(strUrl); } /** * Show next page of folder contents * * @param strNewPos new current pos when go to next page */ function eventHandler_nextPage(sender, strNewPos) { // reload folder contents frame set with new current pos var strUrl = "<%=pageSet.makeUrl(strFolderContentsUrl)%>"; strUrl = urlAddExclusiveParam(strUrl, "objectId", "<%=objectId%>"); strUrl = urlAddExclusiveParam(strUrl, "pagesize", "<%=strPageSize%>"); strUrl = urlAddExclusiveParam(strUrl, "currentpos", strNewPos); strUrl = urlMakeForcedReload(strUrl); window.location.replace(strUrl); } /** * Shows the previous page of folder contents * * @param strNewPos new current pos when go to previous page */ function eventHandler_previousPage(sender, strNewPos) { // reload folder contents frame set with new current pos var strUrl = "<%=pageSet.makeUrl(strFolderContentsUrl)%>"; strUrl = urlAddExclusiveParam(strUrl, "objectId", "<%=objectId%>"); strUrl = urlAddExclusiveParam(strUrl, "pagesize", "<%=strPageSize%>"); strUrl = urlAddExclusiveParam(strUrl, "currentpos", strNewPos); strUrl = urlMakeForcedReload(strUrl); window.location.replace(strUrl); } // update user / docbase name status feedback fireGlobalEvent("updateUserDocbaseStatus", "<%=strUser%>", "<%=strDocbaseName%>"); </script> <% if((objectId { %> <!-- If a specific objectId wasn't given, display a blank page and --> <!-- send out a request to see if anyone knows what should be --> <!-- shown. The setTimeout is important in order to avoid getting an --> <!-- IE "spinning globe" problem. --> <script language='JavaScript'> setTimeout('fireGlobalEvent("announceSelectedFolder")', 100); </script> </head> <frameset rows='*' framespacing='0' border="0" frameborder='no'> <frame noresize scrolling='no' src="<%= strContextPath %>/wdk/component/background/contentBackground.jsp"> </frameset> <% } else == null) ||(objectId.length() == 0))

Documentum Web Development Kit Tutorial

A15

Solution Code
folderContents.jsp

{ %> </head> <!-- Generate a header and body frameset to show the folder contents. --> <frameset rows='110,*,35' border='0' framespacing='0' frameborder='no'> <frame name='header' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='no' src='<%=pageSet.makeUrl(strContextPath + "/wdk/component/contents/ folderHeader.jsp?folderId=" + objectId)%>'> <frame name='body' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='auto' src='<%=pageSet.makeUrl(strContextPath + "/wdk/component/contents/folderBody.jsp")%>'> <frame name='prevNext' frameborder='no' marginwidth=0 marginheight=0 noresize scrolling='no' src='<%=strPrevNextUrl%>' > </frameset> <% } %> </html> <% } catch(Exception err) { // Unlock the page wdkPageContext.releaseSession(); request.setAttribute("ErrorDescription", lookup.getString(DwNLSwdkComponentContents.MSG_FOLDER_CONTENTS_FAILED)); throw err; } %>

A16

Documentum Web Development Kit Tutorial

You might also like