As a high level action, semantic events are relatively infrequent and thus not performance critical. They are sent to all behaviors, with before and after phases. A semantic event consists of a message, such as openDocument, and three fields labeled argument, in, and out, whose exact content types depend on the message, though the rule of thumb is that argument corresponds to the most commonly needed auxiliary data, in holds the sender of the event, and out collects results from participating behaviors.
Semantic events are most often sent to request action and to announce state. Even when a behavior could directly invoke itself, it is often better to request the action and give other behaviors a chance to modify or cancel the request. Other semantic events announce potentially interesting state. Semantic events are most often acted upon by behaviors to implement a requested action, to modify the event, or to update state in response to an annoucement event.
For example, when a document has been loaded, surviving potential 404 File Not Found's and redirections, the system announces openedDocument (note past tense), and the forward/backward behavior adds it to history list. The search behavior announces its results in a searchHits semantic event, which is caught by the scrollbar visualization behavior. Media adaptors for HTML, directory listings, and Zip archive listings all send the table sort behavior, with sortTable as the message, and node and direction in fields. The table sorting behavior catches the event, inspects table to determine the data type of the requested column, sorts, and rearranges the document tree to reflect the sort order.
The Multivalent DVI media adaptor supports specials without modification of the parser-renderer with the same mechanism as used in the rest of the system, the behavior. The parser announces specials as semantic events, passing the special string, and geometric and logical (document tree) positions in fields. Behaviors implementing specials listen for the relevant messages, and have enough information in the fields to accomplish their work. The HyperTeX hypertext and PageSize specials are currently supported, and image and color will be.
See Graphics User Interface.
Some of the more important semantic events that are defined by built-in behaviors include the following. See Document.java, Browser.java, and others in API.