background image
C H A P T E R 2 1
Routing Interface
21-36
Using Routing
access addressing or other information in the entry besides the actual data being
routed, look at the frame in the
fields
slot. However, use of the
fields
slot is
for special cases only and is generally discouraged. This is because it works only in
the In/Out Box, and so ties your stationery to it. If you need to use the
fields
slot
in your stationery, you should always check for the existence of this slot before
using it, and you must be able to handle the case where it is missing.
Also, view definitions to be used by the In/Out Box can have a
rollScrolling
slot. This slot contains a Boolean value. If you set this slot to
true
, the view is
treated as a paper roll-based view that specifies its height. In this case, the In/Out
Box handles scrolling within the view for you, when the user taps the built-in scroll
arrows. If the
rollScrolling
slot is set to
nil
, scrolling functionality must be
provided by the view definition itself, typically with scroll arrows inside the view.
If the
rollScrolling
slot is set to
true
, the target item must have a
height
slot that specifies the height of the item in pixels.
Note that the
newtEditView
proto sets the
rollScrolling
slot to
true
, and
is useful for creating a paper roll-based view definition.
Advanced Alias Handling
21
For sending data, an application may register a routing format that stores
a sent object as an alias in the In Box. In fact, you can set a slot,
storeAlias
, in
the routing format that allows this to happen. When such an object is to be sent by
the transport, the Routing interface automatically resolves the alias into the actual
object that is sent.
However, in some circumstances, you might want to provide your own custom
alias handling. For example, you might want to store an object in the In Box as a
complex frame consisting of some directly stored data and some slots that contain
aliases. In this case, you would override the routing format method
MakeBodyAlias
to construct your own object.
When the system needs to access the item, such as when it is viewed in the In/Out
Box, it sends the message
ResolveBody
to the format. You must override this
method and use it to resolve the alias you constructed in the
MakeBodyAlias
method.
Note that if the send operation fails, the Out Box continues to store the original
unresolved entry.
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна