SDI Forms & Document Classes

These classes are intended to speed up the creation of Windows Desktop applications by providing some standard file handling and Document (i.e. File) management classes.

The classes are shown in the following class diagram:

SDIForm, Document and DocumentManager classes.

To make use of these classes, create a Windows Forms application and change the MainForm to extend SDIForm instead of Form . Then, extend the Document class to represent the contents of the document type you wish to handle - and then extend the DocumentManager class to load and save the file format.

As an example, there are TextDocument and TextDocumentManager classes included.

Also, a number of Sample applications are provided to show how the classes might be used - and illustrating the use of CSV and Java Properties classes at the same time.

The classes are: -

  • SDIForm – extends the System.Windows.Forms.Form class to add Document (file) lifecycle methods (New, Open, Save/As, Close) which make use of Document and DocumentManager derived classes. It also checks to see if a document has been modified before closing.
  • Document – a simple abstract base class containing the name of a document and a modified flag. Extend this class to represent the type of document your application maintains. See TextDocument for a simple example.
  • DocumentManager – a base class which works with an SDIForm to implement Document lifecycle tasks (New, Open, Save/As, Close). The default name and extension are used when creating, opening or saving files. Extend this class to provide a way to read and write documents for your application. See TextDocumentManager for a simple example.
  • TextDocument – a Document with a simple representation of a text file, it holds the text in a single String.
  • TextDocumentManager – a DocumentManager implementation for managing Text documents (*.txt) with methods to Load and Save a text file into a TextDocument as a single String.

Also:

  • DocumentType – a work in progress (so ignore for now) which will encapsulate the name and extension for a document type (e.g. "Text File", "txt").