The Event Model

    The JDK Event Model
        If we use an analogy sometimes it is easier to understand this concept. The most common analogy used is that of the Magazine publisher.  In this model the publisher of the magazine "advertises" the availability of the magazine to potential subscribers. The subscribers "register" with the Publisher to receive the magazine and the Publisher keeps a list of subscribers so that he can deliver the magazine to them. The subscribers will "read" the magazine when it is delivered. (Oh, come on, work with me okay?)

    What are Events?
        Event Objects
            These are like the magazines in the analogy. These are a set of circumstances that occur, like a button is pressed, a page is requested, the field is displayed. These are part of the java.util.EventObject class (NetDynamics extends this class to incorporate some of it's own specific events). These encapsulate state change information.
        Event Source Objects
            These are the Publishers.  They have no specific inheritance and they are used to expose listener registration methods and to create and dispatch events.
        Listener Objects
            These are the subscribers. They implement interfaces derived from java.util.EventListener . They define event handler methods appropriate for a specific event class.
        Event Interaction

    Benefits of the Event Model
        It is very easy to use because it is an intuitive mapping between events and event handlers. It is scalable, you can have many listeners registers with the same source. It is efficient because events are only dispatched if there are registered listeners.
        Most of the development tools that use this model make event registration transparent to the developer by using an event object the code is automatically generated to cause the registration and dispatch to occur. It is important to note that each of the development tools uses it own set of event types and some provide for going beyond the predefined capabilities to take advantage of the advanced OO (Object Oriented) design of Java itself.

    Event Types in ND
        Generic Events
            These events are applicable to both HTML and client side Java objects (pages, fields, etc.).
        Html Only Events
            These are the Project Web Processing events including page web event and HtmlOutput events.
        Client Side Java Only Events
            These are standard Java 1.1 AWT events
        Events can also be classified by what they accomplish.
                Initialization - typically occurring once per project initialization (page session object initialization might be an exception)
                Execution - occurring in response to user actions, like a button or a href click
                Error - these only occur when a potential error is detected by the framework

    Event Flow
            Because any single action can trigger many events we call this event flow. This flow is predictable for any given page. The following graphic is a generalized picture of a NetDynamics page event flow.

        In this example the DoEmployees is a Data Object to the database Employees. The Repeated are repeating fields (like EmployeeLastName) that would appear in a table. The last item is a display of a single item from the first event (which was to get the DoEmployees) which didn't necessarily lead to the first display of information.

 Contents    NetDynamics Server Architecture   State and Session Management