X hits on this document

PDF document

Bart Calder, Bill Shannon - page 9 / 21





9 / 21

Usage Scenarios

display of available files. It includes a function like Explorer’s ‘right mouse’ menu, where all operations that can be performed on a selected data item are listed in a popup menu for that item.

A typical user launches this application to view a directory of files. When the user specifies a file by clicking on it, the application displays a popup menu that lists the available operations on that file. File system viewer utilities normally include ‘edit,’ ‘view,’ and ‘print’ commands as available operations. For instance selecting ‘view’ causes the utility to open the selected file in a viewer that can display data of the data type held in that file.


Scenario Architecture

Description of tasks performed by the application is broken down into three discrete steps, for clarity:

  • Initialization: The application constructs a view of the file system.

  • Getting the Command List: The application presents the command list for a selected data item.

  • Performing the Command: The application performs a command on the selected data object.

5.2 Initialization

One of the interfaces mentioned below is the ‘DataSource’ object. Recall that the DataSource object encapsulates the underlying data object in a class that abstracts the underlying data storage mechanism, and presents its consumers with a common data access and typing interface. The file viewer application queries the file system for its contents.

The viewer instantiates a DataSource object for each file in the directory. Then it instantiates a a DataHandler with the DataSource as its constructor argument. The DataHandler object provides the client application with access to the CommandMap, which provides a service that enables access to commands that can operate on the data. The application maintains a list of the DataHandler objects, queries them for their names to generate its display.

// for each file in the directory: File file = new File(file_name); DataSource ds = new FileDataSource(file); DataHandler dh = new DataHandler(ds);

5.3 Getting the Command List

Once the application has been initialized and has presented a list of files to the user, the user can select a file on the list. When the user selects a file, the application displays a popup menu that lists the available operations on that file.

9 of 21

Document info
Document views86
Page views86
Page last viewedMon Jan 23 10:46:59 UTC 2017