multivalent

Class SemanticEvent

public class SemanticEvent extends AWTEvent

A semantic event, as opposed to a low-level mouse and keyboard events, defines a logical action, such as opening a new document. Rather than directly accomplishing a high-level, logical action, even on itself, a behavior should send a semantic event and give other behaviors a chance to modify it. This also makes these actions available to scripts.

The type of semantic event, or its message, is given by a String field. By using String's, the set of event types is kept open ended. Message detail is given in fields; fields are given suggestive names, but the exact contents depend on the particular semantic event arg, in, out.

Following the Multivalent architectural principle that new behaviors can introduce whatever new structure is needed, any behavior can introduce a semantic event by defining it. Defining means specifying the use of all the fields, usually in the Javadoc comment of a public static final String field that specifies the message. Of course, behaviors should take pains to use existing names when available. The defining behavior usually provides some implementation in its Behavior and/or Behavior methods. For examples of the standard format for event definitions, see MSG_OPEN, MSG_NEW, and MSG_EXECUTE.

Semantic events are thrown or fired by adding them to a browser's event queue. Complete semantic events, which should have a handle to the browser in their source field, can be fired via Browser. The convenience method Browser constructs and fires a semantic with the given String message and Object arg. Semantic events are caught in the Behavior and Behavior methods. Often a behavior will throw and catch the same event.

Version: $Revision: 1.4 $ $Date: 2003/06/02 05:10:16 $

See Also: Document Browser SystemEvents Multipage VMenu SemanticUI

Constructor Summary
SemanticEvent(Object source, String message, Object arg)
SemanticEvent(Object source, String message, Object arg, Object in, Object out)
Method Summary
booleanequals(Object o)
Two SemanticEvents are equal() iff == is true for all their fields (source, message, arg, in, and out).
ObjectgetArg()
ObjectgetIn()
StringgetMessage()
Messages are intern()'ed, so you can compare it with == rather than Object#equals(Object).
ObjectgetOut()
inthashCode()
voidsetArg(Object arg)
StringtoString()

Constructor Detail

SemanticEvent

public SemanticEvent(Object source, String message, Object arg)

SemanticEvent

public SemanticEvent(Object source, String message, Object arg, Object in, Object out)

Method Detail

equals

public boolean equals(Object o)
Two SemanticEvents are equal() iff == is true for all their fields (source, message, arg, in, and out).

getArg

public Object getArg()

getIn

public Object getIn()

getMessage

public String getMessage()
Messages are intern()'ed, so you can compare it with == rather than Object#equals(Object).

getOut

public Object getOut()

hashCode

public int hashCode()

setArg

public void setArg(Object arg)

toString

public String toString()