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

DocumentManager

1. Description

The DocumentManager service handles the document lifecycle tasks and keeps track of all registered document types. This service mediates between the user interface and the document.

2. Motivation

A module developer, who has to implement new document types, should not have to care about things like configuring the OpenFileDialog component or enabling and disabling the save buttons regarding the document status. Additionally if module developers implement all tasks for managing documents themselves the user experience might not be consistent for different document types.

3. Solution

The DocumentManager service helps to implement new document types. The service manages the lifecycle of the documents and mediates between the user interface and the document. The tasks New, Open and Save are taken over by the DocumentManager. The developer just needs to implement the IDocumentFactory and the IDocument interface (Figure 1).

document-manager.png
Figure 1

Participants
  • IDocumentManager: Represents the DocumentManager service. The service keeps track of the registered document types and it is able to create new documents.
  • IDocumentType: Describes a document type. The information contains the file extension and a file type description.
  • IDocumentFactory: The document factory is able to create new documents and open existing ones.
  • IDocument: Describes the behavior of a document. It can save the content and it knows the associated IDocumentType.

4. Example

The RTFEditor module of the Test Suite reference application implements the IDocumentType and the IDocument interface:
  • ModuleController implements IDocumentType
  • DocumentController implements IDocument
Both classes are WorkItemControllers. A sub WorkItem is used to represent a document instance. Thus the document shares its lifecycle with this sub WorkItem.

The implementation of the DocumentManager can be found in the Infrastructure.Module.

Last edited Oct 8, 2007 at 2:43 PM by jbe2277, version 6

Comments

No comments yet.