站内搜索: 请输入搜索关键词
当前页面: 图书首页 > MIDP Style Guide for the Java 2 Platform, Micro Edition

MIDP Style Guide for the Java 2 Platform, Micro Edition

[ directory ] Previous Section Next Section

9.5 Abstract Commands on Alert Screens

Application developers can associate one or more abstract commands with an alert screen. One reason to associate an abstract command with an alert is to provide a label for dismissing the alert. Another time is to enable the user to stop a currently running process.

9.5.1 Labeling the Dismissal of an Alert

A MIDP implementation has no way to know the text of your alert, and therefore cannot provide an application-specific label. Application developers that want a particular label on an alert can provide an abstract command with that label.

Application Developers

Consider: Provide an abstract command to dismiss your alerts so that the dismissal label can be specific to your application. For example, Figure 9.5 shows an application-defined label. Provide the command even when you request a timed alert. You will then have an application-defined label in case a MIDP implementation must present the alert as modal for some reason.

Figure 9.5. Application-Defined Soft Label to Dismiss a Modal Alert

graphics/09fig05.gif

Recommend: graphics/bulb2_icon.gif Use the abstract command types OK and CANCEL where they are appropriate. (See page 137 for more information.)

Recommend: graphics/bulb2_icon.gif Do not give an alert more than two commands. More commands will result in the user having to access a system menu or other user-interface component to dismiss the alert. This makes your application less usable.

Strongly Recommend: graphics/bulb1_icon.gif If you provide an abstract command for an alert, it must dismiss the alert. If you provide more than one abstract command, at least one of the commands must dismiss the alert. (See "Abstract Commands on Alert Screens" on page 130 for more information.)

If the application developer does not provide an abstract command to dismiss the alert, the MIDP implementation must determine how to dismiss it. Typically, the MIDP implementation provides a label for a soft button or key on the device.

MIDP Implementors

Recommend: graphics/bulb2_icon.gif Choose neutral labels for any buttons or keys that dismiss modal dialog boxes. A neutral label is best because you have no way of knowing what message alerts will display. Figure 9.6 shows an example of a neutral label on a modal alert.

Figure 9.6. Label for a Soft Button to Dismiss a Modal Alert

graphics/09fig06.gif

The presence of a single abstract command should not be sufficient to change a timed alert into a modal alert.

Strongly Recommend: graphics/bulb1_icon.gif If the application developer has provided one abstract command and requested a timed alert, make the alert timed if possible. If the alert must be modal for device-specific reasons (such as the text causing the alert to scroll), then use the application's abstract command for the user to dismiss the alert.

The presence of multiple abstract commands, however, means that the alert should be modal.

Consider: If the application developer has both provided multiple abstract commands and requested a timed alert, make the alert modal and use the application's abstract commands for the user to dismiss the alert.

9.5.2 Enabling Users to Stop an Action

Another reason to provide an abstract command on an alert is to enable the user to stop a potentially long-running action. An application developer that wanted this behavior would typically put the abstract command on an alert with a gauge, so that the user could get feedback as the long-running action is carried out.

Application Developers

Consider: Use a modal alert to enable a user to interrupt an operation in progress. Provide an abstract command of type STOP for the interruption. The alert in Figure 9.7 has a command of type STOP (it has the label "Stop") to enable the user to interrupt the operation in progress.

Figure 9.7. Alert with a Command of Type STOP

graphics/09fig07.gif

Consider: When you give an alert a command of type STOP, and the operation reaches a point where the user can no longer interrupt it, remove the abstract command. You can also request that the alert be timed at this point.

    [ directory ] Previous Section Next Section