Routing Formats

Introduction

A routing format is used to specify the items above the separator line in the Action menu. As we said earlier, a routing format is registered as a viewDef and determines the way in which the associated data can be communicated. There are three standard formats (dataTypes):

frame
This provides the actual target. This is used for Beam (a copy of the beamed item appears on the receiving Newton), and for some types of Mail (some support frame enclosures, some don't).

text
This provides a textual description of the target. This is used for Mail.

view
This provides a visual representation of the target. This is used for Print and Fax.

A transport is responsible for taking a target and communicating it somewhere else in one or more of these three dataTypes. The built-in transports are Beam/Mail/Print/Fax. Other transports may be provided by licensees or third parties.

When the user taps on the Action button, the Action button must fill the picker with those transports that are appropriate for the current target. It does so using the following logic:

1. What sort of data is being operated on? Calling ClassOf(target) yields the dataDef symbol.

2. What are the routing formats installed for this data? Calling GetViewDefs with the dataDef symbol from step 1 provides all the installed viewDefs. Those are filtered to find only those whose type is printFormat.

3. Which transports can route the data? Each transport has a list of dataTypes it can route. Each routing format has a list of dataTypes it can work with to provide data. If a routing format can provide a dataType the transport can route, the transport is available for this data (that is, shows up in the Action button). For example, if any routing formats contain the view dataType, then the Print and Fax transports can route the data (since Print and Fax can route view dataTypes). Similarly, if any routing formats contain the text dataType, then the Mail transport can route the data (since it can route text dataTypes).

The Action picker displays the list of transports once it has been built. As we said earlier, when the user selects a transport, the transport can put up a slip to obtain more information from the user. If more than one routing format has specified that it can provide the dataType needed by this transport, the transport provides a Format picker to allow the user to choose between the routing formats (see FIGURE 12.8).

FIGURE 12.8 : Multiple routing formats available for the same transport.


When the user is done with the slip, the soup entry is copied to the Out box soup. In the Out box, the user can display and/or edit this copy (using any registered viewer or editor viewDefs). When it is actually time to send the data, the transport asks the routing format to provide the dataType that it had promised. The transport then transports it.


An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996