2.6. File and Edit Commands

The commands available on the File and Edit menus provide an interface between the Rolodex Tool and the underlying operating environment, including its file system. Different operating environments have potentially varying rules for the processing of these commands. The requirements here are generic and operating-environment independent.

2.6.1. Tool Invocation with and without a Rolodex File

The Rolodex Tool can be invoked both with and without a Rolodex file. Without a file, the tool begins execution with an empty Rolodex workspace containing no cards. The banner of the display window indicates there is no open file, as shown in Figure 1. When invoked with an initial file, the tool begins execution with a workspace containing the cards of the specified file. The banner of the display window indicates the open file by name, as shown for example in Figure 7. The tool may not be open with more than one file at one time.

Depending on the operating environment in which the tool is installed, it can be invoked by name from a command line or by some other means such as operating system command menu, Rolodex tool icon, or Rolodex file icon. The means to specify an initial file is also dependent on the operating environment. Two typical means are typing a file name on the command line, or clicking on the icon of a Rolodex file.

2.6.2. New and Open

The New command creates a new empty rolodex. When the user selects the New command from the File menu, the system first checks if the currently active workspace has been saved since the the most recent updating command. If the workspace requires saving, the system displays the dialog shown in Figure 27.


Figure 27: Offer-to-save dialog.



The offer-to-save dialog appears in a pop-up window separate from the main Rolodex Tool window. To indicate that the file should be saved, the user presses the Save button. At this point, the system proceeds with a Save command, as described in Section 2.6.3.

If the Save command executes successfully or the workspace did not require saving, the system proceeds to execute the New command by clearing the Rolodex workspace, leaving it empty of any cards. The file indicator in the window banner is changed to "[no open file]" and the offer-to-save dialog is closed. Figure 28 shows the result, which is exactly the same screen as when the Rolodex Tool is initially invoked without a file.


Figure 28: Successful New command.



If the user presses Discard in the offer-to-save dialog of Figure 27, the system proceeds with the New command by clearing the workspace, changing the file indicator banner, and closing the pop-up dialog. All unsaved changes to the Rolodex are lost.

If the user presses Cancel in the offer-to-save dialog, the file is not saved and the New command is cancelled, leaving the state of the Rolodex workspace unchanged. The same result obtains if the user cancels the Save command that is initiated by pressing the Save button in the offer-to-save dialog.

The Open command operates in a similar fashion to New. When the user selects Open from the File menu, the system checks the changed status of the workspace and displays the offer-to-save dialog of Figure 27 if the workspace requires saving.

If the Save command executes successfully or the workspace did not require saving, the system proceeds to execute the Open command by displaying the dialog shown in Figure 29


Figure 29: Open dialog.



To complete the open, the user enters the name of the desired file in the dialog text box, as show in Figure 30.


Figure 30: Open dialog filled in.



If the given name is that of an existing and readable Rolodex file, the system responds by opening the file, replacing the current contents of the Rolodex workspace with the file contents, changing the display window banner, and closing the open-file dialog. The result is shown in Figure 31.


Figure 31: File successfully opened.



Section 2.9.4 on file access errors covers the case where the file name to be opened is not a legal Rolodex file or otherwise inaccessible.

The resulting display area for any successful Open command is empty, i.e., it contains the display of no card. Hence, the only display difference between a successful Open command versus a successful New command is the file name in the display banner.

If the user presses Discard in the offer-to-save dialog, the system proceeds with the Open command by displaying the dialog of Figure 29. From this point, the user proceeds as described above, the only difference being that if a file is opened, any unsaved changes to the previously open Rolodex are lost.

If the user presses Cancel in the offer-to-save dialog, the file is not saved and the Open command is cancelled, leaving the state of the Rolodex workspace unchanged. The same result obtains if the user cancels the Save command that is initiated by pressing the Save button in the offer-to-save dialog.

For both the New and Open commands, the precise definition of "requires saving" is based on whether the current state of the Rolodex workspace has changed since the last confirmed execution of a Save command. Specifically, the state of the Rolodex is defined as changed whenever the user executes a confirmed updating command. An updating command is defined as one of the three Rolodex commands Add, Change, or Delete. The execution of an updating command is confirmed when the user presses the OK button in a command confirmation dialog and the command completes execution without error. The confirmation dialog for the Add command is that shown in Figure 5 of Section 2.2. The confirmation dialog for the Change command is that shown in Figures 17 and 20 of Section 2.4. The confirmation dialog for the Delete command is that shown in Figures 23 and 26 of Section 2.5.

This definition of "requires saving" implies the following behaviors for the New and Open commands:

  1. If the user executes New two or more times in succession without an intervening confirmed update, the second and subsequent executions of New have no effect.
  2. For the purposes of the Open command, execution of New does not mean that the state of the rolodex requires saving, just that the rolodex workspace is empty. If the user executes Open on an empty workspace, the offer-to-save dialog is not displayed.

2.6.3. Save and Save As

When the user selects the Save command from the File menu, the system first checks if there is a currently open file. To the user, the currently open file is indicated by its name in banner of the Rolodex Tool main display window. If there is no current file, the string "[no open file]" appears in the banner.

If there is an open file, the system responds to the Save command by saving the current contents of the rolodex workspace onto the current file. No further user interaction is required in this case, and the state of the display screen does not change.

If there is no current file when the user selects Save, the system displays the dialog shown in Figure 32.


Figure 32: File save dialog, from Save with no open file or from Save As.



To complete the save, the user enters the name of the file and presses OK; to cancel the save, the user presses Cancel. In either case, the system closes the pop-up save dialog, removing it from the screen. Figure 33 shows the result of the user having confirmed the save onto the file named "New Rolodex".


Figure 33: Confirmed save.



The only change to the state of the main display window is the file name in the banner having been changed to "New Rolodex". In particular, the contents of the display area are unchanged. E.g., if the display area was empty prior to a Save, then it is empty afterwards. If the display area contained some command dialog prior to a Save, then the same dialog (in the same state) is in the display area afterwards.

When the user selects the Save As command from the File menu, the system displays the dialog shown in Figure 32 The user interacts with this dialog in exactly the same manner as described above for the Save command when there is no open file. The results of a successful Save As command are to write the contents of rolodex workspace to the specified file and to change the file name in the display window banner. The data area display is unchanged.

A Rolodex workspace of any size, including zero cards, can be saved. To allow saving an empty workspace, the definition of "requires saving" for Save and Save As is slightly different from the definition of "requires saving" given earlier for New and Open (at the end of Section 2.6.2). Specifically, for Save and Save As, "requires saving" means that the workspace has changed (by the earlier definition) or the workspace is empty and has not yet been saved. By this revised definition, Save and Save As only have an effect if the current workspace requires saving. Otherwise, Save and Save As have no effect.

This revised definition of "requires saving" implies the following specific behaviors for Save and Save As:

  1. If the user executes Save two or more times in succession without an intervening confirmed update, the second and subsequent executions of Save have no effect.
  2. For the purposes of Save and Save As, execution of New does mean that the state of the rolodex requires saving. This is in contrast to what New means for Open as described earlier. I.e., for the purposes of Open, execution of New does not mean that the workspace requires saving.

Exceptional and error conditions that can arise during execution of the Save and Save As commands are covered, respectively, in Section 2.8.3 on file accessibility and Section 2.9.4 on file access errors.

Details of file-choosing dialogs vary widely in different operating environments. Typically, a file chooser interface is more sophisticated than the simple name-entry dialog shown in Figure 32. Implementors of the Rolodex Tool must provide the file command functionality described in this section via an interface appropriate to the operating environment. In particular, if the operating environment has standards or conventions for how application programs interface with file commands, then implementors must follow those standards or conventions.

2.6.4. Print

When the user selects the Print command from the File menu, the system prints a list of cards, sorted alphabetically by name. Cards with the same name are sorted in ascending order by Id field. Figure 34 shows the result of a Print command for a rolodex containing five cards.


Name: Doe, Jane
Id: 555555555
Age: 55
Sex: F
Address: 5 Main Street, Centerville

Name: Doe, Jane
Id: 666666666
Age: 66
Sex: F
Address: 6 Main Street, Centerville

Name: Doe, Jane
Id: 777777777
Age: 77
Sex: F
Address: 7 Main Street, Centerville

Name: Fisher, Gene
Id: 563928591
Age: 47
Sex: M
Address: 900 Bear Canyon Lane

Name: Smith, John
Id: 111111111
Age: 50
Sex: M
Address: 1313 Mockingbird Lane

Figure 34: Result of Print command.



The specific output format rules are as follows:
  1. The heading for each of the five card fields ("Name:", etc.) is left justified, capitalized, and followed by a colon plus one space character.
  2. The value for each of the five card fields is printed exactly as entered by the user in text boxes of the dialogs for adding or changing a card.
  3. There is one blank line separating each five-line card in the output list.
  4. The sorting of names is based on the lexical comparison of name strings, including punctuation; specifically, the characterwise comparison of name strings is based on the ASCII collating sequence, or comparable collating sequence in standard use in a particular operating environment.

Details of file printing vary widely among different operating environments. Such details include printer selection, setup, and other options. Typically, the user interacts with one or more dialogs to specify printing options. Specific details of this interaction are beyond the scope of these requirements. Implementors of the Rolodex Tool must provide the user access to all necessary functionality to accomplish printing successfully in a given operating environment.

The Rolodex Tool provides only the most basic printing facility. To accomplish more sophisticated output formatting, the user may redirect printing output to a file and open the file in a suitable word processor. This assumes that output redirection is an available printing option in the operating environment and that the user has access to a suitable word processor.

2.6.5. Exit

When the user selects Exit from the File menu, the system first checks if the rolodex workspace requires saving, based on the first definition of "requires saving" given in Section 2.6.2. If the workspace does require saving, the system displays the offer-to-save dialog of Figure 27. If the Save command executes successfully or the workspace did not require saving, the system proceeds to execute the Exit command by halting the Rolodex Tool program, thereby returning the user to the operating environment from which the Rolodex Tool was invoked.

If the user presses Discard in the offer-to-save dialog, the system proceeds with the Exit command, with any unsaved changes to the rolodex workspace being lost.

If the user presses Cancel in the offer-to-save dialog, the file is not saved and the Exit command is cancelled, leaving the Rolodex Tool still running and the state of the Rolodex workspace unchanged. The same result obtains if the user cancels the Save command that is initiated by pressing the Save button in the offer-to-save dialog.

2.6.6. Undo

When the user selects Undo from the Edit menu, the system undoes the effect of the most recently confirmed updating command, or the effect of a previously executed Undo command. As defined at the end of Section 2.6.2. the updating commands are Add, Change, and Delete. For these commands, the precise definition of Undo is that the rolodex workspace is restored to the state that existed immediately prior to the confirmed execution of the command. If no confirmed updating command has been executed since the Rolodex Tool was invoked, Undo has no effect.

If Undo is executed twice in succession, with no intervening confirmed update between the two executions, the effect of the first of the two Undo executions is undone. That is, the state of the rolodex is restored to the state that existed immediately prior to the first Undo. Third and further successive executions of Undo, without an intervening updating command, cause the system to toggle between the state of the workspace with and without the effect of the most recently confirmed update. This behavior means that only a single level of undo is available. That is, only the single most recently executed updating command can be undone.

Undo only applies to the three updating commands and itself, not to any other commands. Specifically, Undo does not apply to:

The Undo command has no effect at all on the display screen. For example, if Undo is executed immediately after an Add command, the contents of the add-card dialog remain on the screen, even though the effect of the Add command has been undone.

2.6.7. Cut, Copy, and Paste

Operating systems typically provide a "clipboard" area through which cut and paste editing commands operate. This clipboard holds values that are cut, copied, and pasted in tools such as the Rolodex. Hence, the Rolodex Cut, Copy, and Paste commands operate through such a clipboard.

To execute the Cut or Copy command, the user must first select a segment of text in a text box. For example, Figure 35 shows the result of the user having selected all of the text in the Name field of an Add dialog.


Figure 35: Text selected for Cut or Copy command.



Text selection is performed using click and drag with the mouse, or by other environment-specific means such as double or triple clicking in a text box. After text selection, when the user selects the Cut command from the Edit menu, the system removes the selected text from the edit box and copies the text into the clipboard. Figure 36 shows the result of the user having selected the Cut command in the context of Figure 35.


Figure 36: Text cut.



When the user selects the Copy command, the selected text is copied to the clipboard, but is not removed from the display in which it is selected and the text remains selected. For example, if the user selects the Copy command in the context of Figure 35. the selected text is copied to the clipboard and the resulting display is completely unchanged from its state immediately prior to the execution of Copy. I.e., after the copy command, the display appears exactly the same as in Figure 35.

A particular segment of selected text is unselected by selecting another text segment or by single-clicking the mouse anywhere in the Rolodex display. Other environment-specific means of unselecting text may be available.

The Cut command can only be executed in the context of a display where the text boxes are editable, i.e., where the user may type in the text boxes. In the Rolodex Tool, the text boxes in which the user may not type are from the Find command, the Delete command, and the multi-card display from the Change command. These non-editing restrictions are explained, respectively, in Section 2.3 , Section 2.5 , and Section 2.4

In contrast to Cut, the Copy command can be executed in any dialog in which text boxes appear, including read-only text boxes. For example, in Figure 37


Figure 37: Text selected for Copy only.



the user has selected text in a found-card dialog. In this case, the Copy command can be executed but the Cut command cannot be executed. The Cut command as no effect when executed in this context.

To execute the Paste command, the user must first execute a Cut or Copy and then place the typing cursor within some editable text box. After these steps, when the user selects the Paste command from the Edit menu, the text stored in the clipboard is inserted at the point of the typing cursor, as if it had been entered by the user from the keyboard. Pasted text appears in normal font, i.e., it is not highlighted as selected text.

If the user attempts to execute a Cut or Copy command without first selecting text, the commands have no effect. If the user attempts to execute a Paste command without having executed either a Cut or Copy, the Paste command has no effect. The Cut, Copy, and Paste commands operate only on plain text strings within a single displayed text box. In particular, the commands do not apply to a complete card.

The use of the clipboard for communication between the Rolodex Tool and the outside operating environment depends on the capabilities of the environment. Specifically, the environment must support the insertion and removal of plain text to and from the clipboard. If this requirement is met, and the operating environment permits inter-tool clipboard communication, then plain text copied to the clipboard from a another tool can be pasted in the Rolodex using Paste. Similarly, plain text cut or copied in the Rolodex Tool can be pasted or otherwise accessed as plain text in another tool, via the clipboard.




Prev: delete | Next: help | Up: functional | Top: index