WO2002025431A2 - Dynamic event handlers for structured text - Google Patents

Dynamic event handlers for structured text Download PDF

Info

Publication number
WO2002025431A2
WO2002025431A2 PCT/US2001/029318 US0129318W WO0225431A2 WO 2002025431 A2 WO2002025431 A2 WO 2002025431A2 US 0129318 W US0129318 W US 0129318W WO 0225431 A2 WO0225431 A2 WO 0225431A2
Authority
WO
WIPO (PCT)
Prior art keywords
event
text
handler
type
stractured
Prior art date
Application number
PCT/US2001/029318
Other languages
French (fr)
Other versions
WO2002025431A3 (en
Inventor
David E. Hollingsworth
Original Assignee
Curl Corporation
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Curl Corporation filed Critical Curl Corporation
Priority to AU2001291123A priority Critical patent/AU2001291123A1/en
Publication of WO2002025431A2 publication Critical patent/WO2002025431A2/en
Publication of WO2002025431A3 publication Critical patent/WO2002025431A3/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications

Definitions

  • This invention relates generally to computer programming languages for creating and delivering content on the World Wide Web, and more specifically to a mechanism for handling events associated with stractured text content.
  • the World Wide Web (“WWW”) or "Web” is the total set of interlinked hypertext documents residing on HyperText Transfer Protocol (“HTTP”) servers all around the world. These servers form the Internet, a worldwide collection of computers, networks and gateways that use the TCP/IP suite of protocols to communicate with one another.
  • Documents on the World Wide Web, called pages or Web pages can be written in Hypertext Markup Language (“HTML"). These documents are identified by Uniform Resource Locators ("URLs”) that specify the particular machine and pathname by which a document can be accessed.
  • URLs Uniform Resource Locators
  • Codes, called tags, embedded in an HTML document associate particular words and images in the document with other URLs such that a user can link to another document, stored on any server on the network, by the press of a key or the click of a mouse.
  • These files may contain text (in a variety of fonts and styles), graphics images, movie files, and sounds, as well as Java 4 " 1 applets, ActiveX ® controls, or other small embedded software programs that execute when the user activates them by activating a link.
  • These tags used in association with text, create stractured text.
  • the World Wide Web was developed by Timothy Berners-Lee in 1989 for the European Laboratory for Particle Physics (CERN).
  • Computer programming languages are used to define a sequence of data and instructions that can ultimately be processed and executed by a computer.
  • the instructions can be translated, from the source code expressed using the programming language to the machine code that the computer works more directly with, by means of another program, such as a compiler or interpreter.
  • Examples of languages for Web content creation and delivery are: HTML; the Java ta computer programming language; and the CurrTM computer programming language.
  • the Curl computer programming language is developed by Curl Corporation, Cambridge, Massachusetts.
  • HTML is an application of the Standard Generalized Markup Language (“SGML”) and uses tags to mark content elements, such as text and graphics, in a document to indicate how Web browsers should display this content to the user and how the content should respond to user actions, such as activation of a link by means of a key press or mouse click.
  • HTML is defined, in various versions, by the Internet Engineering Task Force (“IETF”) and by the World Wide Web Consortium (“W3C”).
  • Java is an object-oriented programming language, developed by Sun Microsystems, Inc. Similar to C++, Java is smaller, more portable, and easier to use than C++ because it is more robust and it manages memory on its own. Java was also designed to be secure and platform-neutral. Java programs are compiled into bytecodes, which are similar to machine code and are not specific to any platform, making it a useful language for programming Web applications, since users access the Web from many types of computers. Currently, the most widespread use of Java is in programming small applications, or applets, for the World Wide Web.
  • the Curl computer programming language is designed to present a single, coherent linguistic basis for the expression of Web content at levels ranging from simple formatted (structured) text to complex object-oriented programs.
  • the Curl computer programming language is intended to be a gentle slope system, accessible to content creators at all skill levels ranging from novice content developers to experienced computer programmers. More information on the Curl computer programming language can be found in the paper entitled “Curl: A Gentle Slope Language For The Web” by M. Hostetter, D. Kranz, C. Seed, C. Terman and S. Ward of the Massachusetts Institute of Technology Laboratory for Computer Science.
  • the Curl computer programming language presents an object-oriented system that comprises both a static (compile-time) mode and a dynamic (run-time) mode.
  • compile-time an object's structure, or class definition (i.e., data and methods) is described.
  • class definition i.e., data and methods
  • run-time an instance of an object, based upon its class definition, can be created. The run-time object can then act upon, and be acted upon, by other objects created in the run-time system.
  • Web programming languages such as the Curl computer programming language
  • An event is an action or occurrence, generated by a user or by the system itself, to which a computer program might wish to respond. For example, key presses, button clicks, mouse movements and timers are all types of events.
  • Web programming languages with event processing capabilities can be used to created event-driven programs. In contrast to event-driven programs, polling-driven programs are required to interrogate, and effectively anticipate, every interaction with the program.
  • Event processing operates through the creation and maintenance of an event queue. Events that occur are appended to the event queue for the program to process.
  • Event based Web programming languages have proven to be an efficient way in which to process interactions with Web content.
  • Structured text is standard text that has been marked up with semantic or presentation information.
  • Existing computer programming languages for Web content development provide event mechanisms that can associate existing events with structured text. But, most require that the association be done statically at compile-time, not dynamically at run-time. Additionally, other existing computer programming languages provide for dynamic association of events, but lack the ability to associate those events with stractured text. Even within systems that do allow event handlers to be added dynamically at run-time, their static set of event types means that users are not able to create new event scenarios. Without an ability to dynamically define new event types and dynamically attach event handlers to structured text objects content developers are restricted in their ability to created flexible and effective content using stractured text. Accordingly, the present invention provides an event mechanism for dynamically defining the actions to be performed on structured text when various events occur within computer systems.
  • a method of dynamically defimng event handlers for stractured text comprises: defining an event type; creating, at runtime, an event handler responsive to the event type; and associating the event handler with the stractured text.
  • the event handler associated with the stractured text is created, it can be invoked to perform actions on the stractured text.
  • the creation and association of the event handler can occur at run-time, thereby providing dynamic event handlers for stractured text.
  • the defined event type can be used to invoke multiple event handlers.
  • the event handler invoked can also consume the event type, possibly preventing other event handlers from processing it.
  • the definition of the event type can occur at run-time, as well as at compile-time, thereby providing for dynamic event type creation.
  • Creating an event handler comprises providing executable code for processing the event type and associating that executable code with an event target (e.g., a structured text object).
  • the executable code, or a pointer to the executable code can be supplied to the event handler.
  • the Curl computer programming language provides an ON macro.
  • a macro in a programming language, is a named set of instructions used to assist in the construction of more complex code.
  • the Curl ON macro provides input parameters that assist in the creation of event handlers.
  • Input parameters to the ON macro must include an event type and can optionally include: a variable name for the event type, a type of event target and a variable name for the event target.
  • the first optional parameter is the name of a variable is to be bound to the event type being handled during the execution of the handler body. This variable will be of the type indicated as a parameter.
  • the parameter is not the variable itself; the variable is created inside the macro.
  • the second optional parameter is the type of event target to which the handler should be attached. This parameter is only useful when used in conjunction with the third optional parameter.
  • the third optional parameter is the name of a variable to be bound to the event target during the execution of the handler body. This variable will be of the type indicated in the optional second parameter.
  • the parameter is not the variable itself; the variable is created inside the macro.
  • An embodiment of the present invention provides a method of defining and invoking dynamic event handlers for stractured text comprises using class definitions to create objects to process events on structured text.
  • An object of an object class capable of firing events is created, along with an event object of an event class capable of specifying an event type. In environments that support procedures separate from objects, there is no need to create a specific object to fire an event.
  • a stractured text object of a structured text class capable of representing content is also created, the structured text object being enabled to interact with the event type.
  • an event handler object is created from an event handler class capable of processing the event type for the structured text object.
  • EventHander a way to create an EventHander include: doing run-time type analysis on the handler procedure's arguments, storing the event type separate from the handler procedure, or not storing the type at all and having the implementor of the handler procedure check the type.
  • the dynamic nature of the definition of the event handlers on stractured text overcomes the inherent inflexibility associated with systems that require static (i.e., compile-time) definition of event handlers and event types. Additionally, dynamic event handlers for stractured text allow for scalability in systems that must react quickly to demands for enhanced features in the area of Web content presentation.
  • Figure 1 illustrates a computer system on which an embodiment of the present invention is implemented.
  • Figure 2 shows the internal structure of the computer of Figure 1.
  • Figure 3 illustrates the class hierarchies defined in an embodiment of the present invention.
  • Figure 4 illustrates the objects and object interactions of an embodiment of the present invention.
  • Figure 5 is a flowchart of the process of providing executable code for processing an event type.
  • Stractured text is an important aspect of defining effective Web content. It provides for text characters to be marked up with presentation information when displayed. Event mechanisms within computer systems provide an ability to communicate the occurrence of various actions among objects within the system. The ability to dynamically define event types and event handlers enhances the effectiveness of event mechanisms. Applying dynamic event type and event handlers to stractured text provides a convergence of processing and content that allows for effective and powerful text presentation. There are two ways of representing text using the Curl computer programming language: as traditional programming language strings, or as text that has been marked up with presentation information. The presentation information allows the Curl computer programming language to present the text in a stylized way, similar to the behavior obtained when using Rich Text Format ("RTF"), HTML, or TeX.
  • RTF Rich Text Format
  • the Curl computer programming language's representation of text content is object-oriented and hierarchically structured.
  • a hierarchical representation of a document as stractured text could include a node representing each section of the document.
  • a root node could be associated with all the nodes representing the sections.
  • Each section node could be associated with nodes representing individual paragraphs of the document.
  • Each paragraph node could contain the paragraph's text directly, or it might be further decomposed into sub-nodes based on sentences, or words, for example.
  • the Curl computer programming language's Element class is the base class for its structured text class, TextElement.
  • the Element class is a subclass of EventTarget, enabling events to be fired at any stractured text node in the document tree.
  • TextElement's initialization method is well-behaved with respect to the EventTarget protocol, so that EventHandler parameters passed to the initialization method of TextElement will be added as dynamic event handlers on the Element.
  • the Curl computer programming language supports a markup language, similar to HTML. These markups are generally simple syntax wrappers around the initialization method of the appropriate Element classes, well-behaved markups within the Curl computer programming language will also accept EventHandlers as parameters. The EventHandler will be passed a parameter to the Element initialization method, which will eventually result in the handler being added to the object's dynamic event handler list. These syntax wrappers provide another way to dynamically add an event handler to an object.
  • the present invention provides an event mechanism for defining, at run-time, the actions to be performed on structured text when various events occur within computer systems.
  • FIG. 1 illustrates a computer system on which an embodiment of the present invention is implemented.
  • a computer 100 provides processing and input/output devices for developing and viewing content.
  • Computer 100 is connected to a keyboard 102 and mouse 104 for receiving input and a display 106 for presentation of content.
  • Computer 100 is also linked to a network 110 having access to servers (112, 114).
  • the network can be part of the Internet, the worldwide collection of computers, networks and gateways that use the TCP/TP suite of protocols to communicate with one another.
  • the Internet provides a backbone of high-speed data communication lines between major nodes or host computers, consisting of thousands of commercial, government, educational, and other computer systems, that route data and messages.
  • Servers (112,114) connected to the network 110 can host content for display on computer 100.
  • the content can include specially formatted Web pages hosted on a Web server 114 connected to the network 110.
  • Figure 2 shows the internal structure of the computer of Figure 1.
  • the computer 100 contains a system bus 204, a bus is a set of hardware lines used for data transfer among the components of a computer system.
  • a bus is essentially a shared highway that connects different parts of the system (e.g., processor, disk-drive controller, memory, and input/output ports) which enables the different parts to transfer information.
  • Attached to system bus 204 is display interface 206, display interface 206 allows display 106 to communicate with other components on system bus 204.
  • Keyboard interface 208 and mouse interface 210 are also attached to system bus 204 and allows the input devices to communicate with other components on system bus 204.
  • Network interface 212 provides the link to an external network (e.g., network 110) allowing processes running on computer 100 to communicate with servers (112,114) connected to a network 110.
  • a memory 200 can store computer software instructions and data structures used to implement an embodiment of the present invention.
  • a processor 202 executes instructions stored in memory 200, allowing the computer 100 to process and display Web content, including stractured text.
  • object-oriented paradigm in which a system is viewed as a collection of discrete objects that are self-contained collections of data structures and routines having the ability to interact with other objects in the system.
  • Object-oriented systems provide for the definition of classes that can be used to create (instantiate) objects of that class.
  • the objects allow for the encapsulation of data and provide well defined interfaces for other objects to use when sending data to, or receiving data from, an object.
  • One class definition can inherit (subclass) the capabilities of another, allowing more complex classes to be build from simpler, underlying classes.
  • Classes, as used in this description, are allowed to be subclasses of themselves.
  • the classes can also specify certain behaviors that are only fully defined at run-time.
  • Programs written using the Curl computer programming language can be notified of the occurrence of various events of interest by means of an event mechanism. Events often occur as a result of user interaction, such as pressing a key on the keyboard, moving the pointer across the display screen, or clicking a mouse button on a graphical object. Not all events are a result of outside interaction; the Curl run-time itself can also explicitly instantiate events. When a particular type of event occurs, an event object of that type is instantiated.
  • classes are defined for an Event, an EventTarget and an EventHandler.
  • the following description contains examples of programming concepts of the present invention in pseudocode. This code resembles the Curl computer programing language, but is not intended to conform to the syntax of any existing language.
  • the pseudocode is presented to illustrate concepts, not define implementation details. Example implementations of
  • Event, EventTarget and EventHandler classes follow.
  • the Event class represents an interaction that occurs within the computer system that is meant to be communicated to objects within the computer system. Events can be created and fired as a result of external interaction (e.g., a key press) or created explicitly (e.g., because a timer expired). Events can represent actions taken in the past, actions currently being taken, or actions to taken in the future.
  • the EventTarget class provides an object with the ability to receive and process events that may be targeted (fired) at it.
  • EventHandler class provides dynamic handlers (attached at runtime) and static handlers (i.e., methods of EventTarget class) for processing Events. ⁇ define-class EventHandler
  • Curl Event represents the existence of an event, its mere existence does not mean that the event is occurring. Because events can be occurring now, may have occurred in the past, or may occur in the future, a Curl Event can represent an event occurring in various time frames. The actual occurrence of the event is represented by calling the fire method on an Event; this is known as firing the event. Generally, Events are created, fired, then released, but this sequence is not required. Curl objects are allowed to store Event objects (previously fired or not), fire an Event more than once, or create and release an Event without ever firing it.
  • the firing of an Event does not occur blindly; instead, the event is fired at a specific target.
  • the target must be a subclass of the EventTarget class.
  • the Event can be fired at more than one object by changing the target and refiring it.
  • Some Event types are processed by an algorithm that searches for targets and fires the Event at each of the found targets.
  • Each EventTarget has a (possibly empty) set of EventHandlers that may process the event.
  • Each handler will only process events of a specific Event class, or subclasses of that class.
  • a handler for events of type Event will process all events fired at the EventTarget, since all events must be subclasses of Event.
  • EventHandlers There are two types of EventHandlers: static and dynamic. Static EvenHandlers are simply methods of EventTarget. It is the responsibility of each Event subclass to call the appropriate static EventHandler methods on the target. For some types of Events, there maybe no static handlers that are appropriate; for others, there may be several.
  • the predefined Event types are associated with particular static EventHandlers; for example, the KeyPress event will call the on-key-press() method on the EventTarget.
  • the default static event handlers on EventTarget perform no action; they are merely placeholders for subclasses to provide their own handlers by overriding the methods.
  • Dynamic EventHandlers are not intrinsic to the EventTarget, but can added to, or removed from, the EventTarget at runtime.
  • dynamic EventHandlers are procedures stored on the dynamic event handler list of the
  • EventTarget and are only called for events of a specific class (or subclasses of that class). There can be more than one dynamic EventHandler for the same Event on a target, and there can be a dynamic EventHandler for an Event that also has a static handler on the same EventTarget.
  • the order in which the dynamic EventHandlers are called on an EventTarget may be undefined, although all dynamic EventHandlers for an Event will be called before the static EventHandler (if any) is called.
  • An EventHandler can perform its specified task and also request that other handlers not act on that specific event by consuming the event it handles.
  • One way to indicate that an EventHandler has consumed an Event is to set a flag on the Event. A mechanism for enforcing this convention is not required within Event,
  • EventTarget or EventHandler
  • EventHandler although there are specific algorithms within the Curl run-time that use this mechanism to stop searching for new targets at which to fire an Event if the Event has been consumed.
  • Each EventTarget keeps a list of its EventHandlers. EventHandlers are added to an EventTarget through the add-event-handler method().
  • EventTarget provides a mechanism for adding dynamic event handlers when creating the EventTarget.
  • the intialization method of EventTarget takes a variable number of parameters: for each parameter that is of type EventHandler, the EventTarget will call add-event-handler() on itself, passing the initialization parameter as the argument to add-event-handler(). Since any class' initialization method can pass its parameters to the initialization method of its superclass, it is very simple for any subclass of EventTarget to accept EventHandlers when it is created.
  • EventHandler When an Event is fired at an EventTarget, the EventTarget considers each EventHandler on its list. If the EventHandler is defined to handle that type of event, its procedure is called with the Event as its first argument, and the EventTarget as its second argument. The event mechanism allows for all of the EventHandlers on the list to be considered, even if the Event is consumed.
  • FIG. 3 illustrates the class hierarchies defined in an embodiment of the present invention.
  • the Object class 350 is a base class for all other classes and is implicit in their definition.
  • Event class 352 is a subclass of Object Class 350, Event class 352 is a parent class to WindowEvent (e.g., PointerPress, KeyPress) and SelectionEvent.
  • BasicEventTarget class 354 contains methods used internally by an event queuing mechanism and is a parent of EventTarget class 356.
  • EventTarget class 356 allows EventHandlers to be attached to objects and allows Events to be fired at those objects.
  • Visual Class 358 inherits from the EventForwarder class and is part of the internal mechanism for dispatching pointer events.
  • the Element class 360 is the parent of StructualElement and TextElement class 362.
  • the EventHandler class 364 supports the processing of Event types using executable code to act upon the EventTarget.
  • FIG. 4 illustrates the objects and object interactions of an embodiment of the present invention.
  • an Object 300 fires an Event 302 at an EventTarget 306.
  • StracturedText 304 object has subclassed EventTarget 306.
  • EventTarget 306 invokes EventHandler 308 to process the Event 302.
  • EventHandler 308 calls static methods 310 (i.e., those defined in the class definition) and dynamic procedures 312 (i.e., those added dynamically) on EventHandler 308. These static methods 310 and dynamic procedures 312 act on StracturedText 304 to effect the actions associated with Event 302 on StracturedText 304.
  • dynamic event handlers for structured text can be used to process a command to capitalize a portion of text in a content display system.
  • the base Event classes described above can be extended to more closely capture the semantics of a particular event (e.g., capitalization).
  • An Event and EventHandler are defined, the EventHandler is then attached to a stractured text object and invoked to perfo ⁇ n the capitalization.
  • the class, CapitalizeEvent is defined as a subclass of Event.
  • the underlying Event class provides the basics of event processing.
  • a CapitalizeEvent object can define a more specific target type, TextElement, for the CapitalizeEvent to be fired at.
  • a CapitalizeHandler instance can also be created to perform the actual capitalization on the text. For example:
  • EventHandler is attached to an EventTarget (e.g. the structured text object defined by TextElement) to enable the Event to be fired.
  • EventTarget e.g. the structured text object defined by TextElement
  • the EventHandler can be added to the stractured text object after the structured text object has been created, using a method provided for associating
  • the EventHandler can be added to the structured text object when it is created. For example: ⁇ paragraph "this application will be filed in the united states patent and trademark office.” ⁇ value CapitalizeHandler ⁇ The EventHandler can be also added to the stractured text object when it is created, providing the actual code at the same time. For example:
  • EventHandler can be invoked by firing an Event at the EventTarget.
  • EventHandler to be invoked can be combined by providing executable code during the attachment process.
  • One preferred embodiment uses the ON macro to process a
  • PointerPress event For example:
  • the creation of a dynamic EventHandler has two steps: 1) writing the code for the handler, and 2) attaching the handler to a target.
  • EventHandler can be defined directly using the "define-proc" mechanism. For example, using the CapitalizeEvent discussed above, an EventHandler can be defined follows:
  • the Curl computer programming language also provides an ON macro to assist in writing the EventHandler code. Although use of the ON macro is not required it can simplify the creation of dynamic event handlers. There are several ways in which one can use the ON macro. An example of the simplest form of the ON macro is:
  • ⁇ event-type> specifies the class of event to handle
  • ⁇ event-var> is the name of a variable that will contain the instance of the event that was fired
  • ⁇ target-type> specifies the class of event target onto which the handler will be attached
  • ⁇ target-var> is the name of a variable that will contain the instance of the target at which the event was fired, and ⁇ body> is the actual event handler code.
  • the handler will also be called for events that are subclasses of ⁇ event-type>, and that the handler can be attached to objects that are subclasses of ⁇ target-type>.
  • the ON macro can be used to directly invoke the procedure upon the occurrence of the event, for example:
  • ⁇ proc> is a procedure of no parameters that contains the event handler code.
  • the ON macro creates and returns an object of type EventHandler. An object of this type can also be created directly.
  • EventHandler class takes two parameters: the type of event to handle, and a procedure to call when the handler is invoked.
  • the procedure takes two parameters: an Event and an EventTarget.
  • FIG. 5 is a flowchart of the process of providing executable code for processing an event type in the implementation of the ON macro.
  • the process starts at step 402.
  • the variables used in the process: ⁇ event-var>, ⁇ event-type>, ⁇ target-var>, ⁇ target-type>, ⁇ body>, and ⁇ proc> are initialized to null at step 402.
  • Step 404 parses the next expression.
  • Step 406 determines if the expression is an identifier. If it is, Step 408 sets the variable ⁇ event-type> to that identifier; otherwise, Step 410 determines if the expression is a pair of a name and an identifier. If it is, Step 412 sets the variable ⁇ event-var> to the name and the variable ⁇ event-type> to the identifier; otherwise Step 414 throws an error and execution exits. Step 412 and Step 408 both proceed to Step 416.
  • Step 416 parses the next expression.
  • Step 418 determines if the expression is the word "at”. If it is, execution proceeds to Step 420; otherwise, execution jumps to Step 432.
  • Step 420 parses the next expression.
  • Step 422 determines if the expression is an bidentifier. If it is, Step 424 sets the variable ⁇ target-type> to that identifier; otherwise, Step 426 determines if the expression is a pair of a name and an identifier. If it is, Step 428 sets the variable ⁇ target-var> to the name and the variable ⁇ target-type> to the identifier; otherwise Step 430 throws an error and execution exits. Step 424 and Step 428 both proceed to Step 432.
  • Step 432 parses the next expression.
  • Step 434 determines if the expression is the word "do". If it is, execution proceeds to Step 434; otherwise, Step 436 throws an error and execution exits. Step 434 stores the remaining expressions in ⁇ body>.
  • Step 438 determines if ⁇ event-var> is null. If it is, Step 440 generates a unique name and sets ⁇ event-var> to it; in either case, execution proceeds to Step 442.
  • Step 442 determines if ⁇ target-var> is null. If it is, Step 444 generates a unique name and sets ⁇ target-var> to it; in either case, execution proceeds to Step 446.
  • Step 446 determines if ⁇ target-type> is null. If it is, Step 448 sets ⁇ target-type> to EventTarget; in either case, execution proceeds to Step 450.
  • Step 450 creates a new procedure and sets ⁇ proc> to it.
  • This procedure has an argument named ⁇ event-var> of type ⁇ event-type>, and an argument named ⁇ target-var> of type ⁇ target-type>.
  • the body of the procedure is ⁇ body>.
  • Step 452 creates and returns an EventHandler with arguments ⁇ event-type> and ⁇ proc>.
  • Step 454 is the end.
  • a TranslateEventHandler that looks up the text in a language translation dictionary and pops up a window displaying the results.
  • An ExecuteEventHandler can invoke the Curl just-in-time compiler on the text; if the text was valid Curl code, the compiled program would be executed.
  • An AnimateEventHandler might adjust the appearance of the rendered text, not the content, with each firing, by updating a marquee that marches around each glyph.
  • a FindDocumentationEventHandler might pop up a documentation system and perform a query using the selected text.

Abstract

An event mechanism is provided to enable the association of dynamic event handlers for structured text comprises defining an event type; creating, at run-time, an event handler responsive to the event type; and associating the event handler with the structured text. Once the event handler associated with the structured text is created, it can be invoked to perform desired actions on the structured text. The creation and association of the event handler occurs at run-time, providing dynamic event handlers for structured text. The defined event type can be used to invoke multiple event handlers. The event handler invoked can also consume the even type, possibly preventing other events handlers from processing it. The definition of the event type can occur at run-times as well as at compile-time, thereby providing for dynamic event type creation.

Description

DYNAMIC EVENT HANDLERS FOR STRUCTURED TEXT
BACKGROUND OF THE INVENTION
This invention relates generally to computer programming languages for creating and delivering content on the World Wide Web, and more specifically to a mechanism for handling events associated with stractured text content.
The World Wide Web ("WWW") or "Web" is the total set of interlinked hypertext documents residing on HyperText Transfer Protocol ("HTTP") servers all around the world. These servers form the Internet, a worldwide collection of computers, networks and gateways that use the TCP/IP suite of protocols to communicate with one another. Documents on the World Wide Web, called pages or Web pages, can be written in Hypertext Markup Language ("HTML"). These documents are identified by Uniform Resource Locators ("URLs") that specify the particular machine and pathname by which a document can be accessed. Codes, called tags, embedded in an HTML document associate particular words and images in the document with other URLs such that a user can link to another document, stored on any server on the network, by the press of a key or the click of a mouse. These files may contain text (in a variety of fonts and styles), graphics images, movie files, and sounds, as well as Java4"1 applets, ActiveX® controls, or other small embedded software programs that execute when the user activates them by activating a link. These tags, used in association with text, create stractured text. The World Wide Web was developed by Timothy Berners-Lee in 1989 for the European Laboratory for Particle Physics (CERN).
Content on the World Wide Web is created and controlled using various computer programming languages. Computer programming languages are used to define a sequence of data and instructions that can ultimately be processed and executed by a computer. The instructions can be translated, from the source code expressed using the programming language to the machine code that the computer works more directly with, by means of another program, such as a compiler or interpreter. Examples of languages for Web content creation and delivery are: HTML; the Javata computer programming language; and the Curr™ computer programming language. The Curl computer programming language is developed by Curl Corporation, Cambridge, Massachusetts.
HTML is an application of the Standard Generalized Markup Language ("SGML") and uses tags to mark content elements, such as text and graphics, in a document to indicate how Web browsers should display this content to the user and how the content should respond to user actions, such as activation of a link by means of a key press or mouse click. HTML is defined, in various versions, by the Internet Engineering Task Force ("IETF") and by the World Wide Web Consortium ("W3C").
Java is an object-oriented programming language, developed by Sun Microsystems, Inc. Similar to C++, Java is smaller, more portable, and easier to use than C++ because it is more robust and it manages memory on its own. Java was also designed to be secure and platform-neutral. Java programs are compiled into bytecodes, which are similar to machine code and are not specific to any platform, making it a useful language for programming Web applications, since users access the Web from many types of computers. Currently, the most widespread use of Java is in programming small applications, or applets, for the World Wide Web.
The Curl computer programming language is designed to present a single, coherent linguistic basis for the expression of Web content at levels ranging from simple formatted (structured) text to complex object-oriented programs. The Curl computer programming language is intended to be a gentle slope system, accessible to content creators at all skill levels ranging from novice content developers to experienced computer programmers. More information on the Curl computer programming language can be found in the paper entitled "Curl: A Gentle Slope Language For The Web" by M. Hostetter, D. Kranz, C. Seed, C. Terman and S. Ward of the Massachusetts Institute of Technology Laboratory for Computer Science.
The Curl computer programming language presents an object-oriented system that comprises both a static (compile-time) mode and a dynamic (run-time) mode. At compile-time, an object's structure, or class definition (i.e., data and methods) is described. At run-time an instance of an object, based upon its class definition, can be created. The run-time object can then act upon, and be acted upon, by other objects created in the run-time system.
Most Web programming languages, such as the Curl computer programming language, provide a mechanism for processing events. An event is an action or occurrence, generated by a user or by the system itself, to which a computer program might wish to respond. For example, key presses, button clicks, mouse movements and timers are all types of events. Web programming languages with event processing capabilities can be used to created event-driven programs. In contrast to event-driven programs, polling-driven programs are required to interrogate, and effectively anticipate, every interaction with the program. Event processing operates through the creation and maintenance of an event queue. Events that occur are appended to the event queue for the program to process. Event based Web programming languages have proven to be an efficient way in which to process interactions with Web content.
SUMMARY OF THE INVENTION
Structured text is standard text that has been marked up with semantic or presentation information. Existing computer programming languages for Web content development provide event mechanisms that can associate existing events with structured text. But, most require that the association be done statically at compile-time, not dynamically at run-time. Additionally, other existing computer programming languages provide for dynamic association of events, but lack the ability to associate those events with stractured text. Even within systems that do allow event handlers to be added dynamically at run-time, their static set of event types means that users are not able to create new event scenarios. Without an ability to dynamically define new event types and dynamically attach event handlers to structured text objects content developers are restricted in their ability to created flexible and effective content using stractured text. Accordingly, the present invention provides an event mechanism for dynamically defining the actions to be performed on structured text when various events occur within computer systems.
In an embodiment of the present invention a method of dynamically defimng event handlers for stractured text comprises: defining an event type; creating, at runtime, an event handler responsive to the event type; and associating the event handler with the stractured text. Once the event handler associated with the stractured text is created, it can be invoked to perform actions on the stractured text. The creation and association of the event handler can occur at run-time, thereby providing dynamic event handlers for stractured text. The defined event type can be used to invoke multiple event handlers. The event handler invoked can also consume the event type, possibly preventing other event handlers from processing it. The definition of the event type can occur at run-time, as well as at compile-time, thereby providing for dynamic event type creation. Creating an event handler comprises providing executable code for processing the event type and associating that executable code with an event target (e.g., a structured text object). The executable code, or a pointer to the executable code can be supplied to the event handler. To facilitate the creation of event handlers the Curl computer programming language provides an ON macro. A macro, in a programming language, is a named set of instructions used to assist in the construction of more complex code. The Curl ON macro provides input parameters that assist in the creation of event handlers.
Input parameters to the ON macro must include an event type and can optionally include: a variable name for the event type, a type of event target and a variable name for the event target. The first optional parameter is the name of a variable is to be bound to the event type being handled during the execution of the handler body. This variable will be of the type indicated as a parameter. The parameter is not the variable itself; the variable is created inside the macro. The second optional parameter is the type of event target to which the handler should be attached. This parameter is only useful when used in conjunction with the third optional parameter. The third optional parameter is the name of a variable to be bound to the event target during the execution of the handler body. This variable will be of the type indicated in the optional second parameter. The parameter is not the variable itself; the variable is created inside the macro.
The following example code illustrates the parameter concepts of the ON macro:
{let et:EventTarget = {SomeEventTarget} {paragraph
{on e:PointerPressEvent at et:EventTarget do {et.phone-home} }
"hello!"
} When a user clicks on the paragraph, the value of the variable "et" on which the method "phone-home" is called, is the paragraph, not the SomeEventTarget object. The latter is a second variable, whose scope is bound outside the ON macro, but not inside it.
An embodiment of the present invention provides a method of defining and invoking dynamic event handlers for stractured text comprises using class definitions to create objects to process events on structured text. An object of an object class capable of firing events is created, along with an event object of an event class capable of specifying an event type. In environments that support procedures separate from objects, there is no need to create a specific object to fire an event. A stractured text object of a structured text class capable of representing content is also created, the structured text object being enabled to interact with the event type. At run-time an event handler object is created from an event handler class capable of processing the event type for the structured text object. The object then fires the event object at the structured text object, the stractured text object invokes the event handler object associated with the event type specified in the event object and the desired actions are performed on the stractured text object. Alternate ways to create an EventHander include: doing run-time type analysis on the handler procedure's arguments, storing the event type separate from the handler procedure, or not storing the type at all and having the implementor of the handler procedure check the type.
The dynamic nature of the definition of the event handlers on stractured text provided by the present invention overcomes the inherent inflexibility associated with systems that require static (i.e., compile-time) definition of event handlers and event types. Additionally, dynamic event handlers for stractured text allow for scalability in systems that must react quickly to demands for enhanced features in the area of Web content presentation.
BRIEF DESCRIPTION OF THE DRAWINGS The foregoing and other objects, features and advantages of the invention will be apparent from the following more particular description of preferred embodiments of the invention, as illustrated in the accompanying drawings in which like reference characters refer to the same parts throughout the different views. The drawings are not necessarily to scale, emphasis instead being placed upon illustrating the principles of the invention.
Figure 1 illustrates a computer system on which an embodiment of the present invention is implemented.
Figure 2 shows the internal structure of the computer of Figure 1.
Figure 3 illustrates the class hierarchies defined in an embodiment of the present invention.
Figure 4 illustrates the objects and object interactions of an embodiment of the present invention.
Figure 5 is a flowchart of the process of providing executable code for processing an event type.
DETAILED DESCRIPTION OF THE INVENTION
Stractured text is an important aspect of defining effective Web content. It provides for text characters to be marked up with presentation information when displayed. Event mechanisms within computer systems provide an ability to communicate the occurrence of various actions among objects within the system. The ability to dynamically define event types and event handlers enhances the effectiveness of event mechanisms. Applying dynamic event type and event handlers to stractured text provides a convergence of processing and content that allows for effective and powerful text presentation. There are two ways of representing text using the Curl computer programming language: as traditional programming language strings, or as text that has been marked up with presentation information. The presentation information allows the Curl computer programming language to present the text in a stylized way, similar to the behavior obtained when using Rich Text Format ("RTF"), HTML, or TeX. The Curl computer programming language's representation of text content is object-oriented and hierarchically structured. A hierarchical representation of a document as stractured text could include a node representing each section of the document. A root node could be associated with all the nodes representing the sections. Each section node could be associated with nodes representing individual paragraphs of the document. Each paragraph node could contain the paragraph's text directly, or it might be further decomposed into sub-nodes based on sentences, or words, for example. The Curl computer programming language's Element class is the base class for its structured text class, TextElement. The Element class is a subclass of EventTarget, enabling events to be fired at any stractured text node in the document tree. TextElement's initialization method is well-behaved with respect to the EventTarget protocol, so that EventHandler parameters passed to the initialization method of TextElement will be added as dynamic event handlers on the Element. In addition to creating Elements directly, the Curl computer programming language supports a markup language, similar to HTML. These markups are generally simple syntax wrappers around the initialization method of the appropriate Element classes, well-behaved markups within the Curl computer programming language will also accept EventHandlers as parameters. The EventHandler will be passed a parameter to the Element initialization method, which will eventually result in the handler being added to the object's dynamic event handler list. These syntax wrappers provide another way to dynamically add an event handler to an object. When an event mechanism is combined with stractured text, a system is created for communicating, from objects within the system, a desire to perform various actions on stractured text. Accordingly, the present invention provides an event mechanism for defining, at run-time, the actions to be performed on structured text when various events occur within computer systems.
Figure 1 illustrates a computer system on which an embodiment of the present invention is implemented. A computer 100 provides processing and input/output devices for developing and viewing content. Computer 100 is connected to a keyboard 102 and mouse 104 for receiving input and a display 106 for presentation of content. Computer 100 is also linked to a network 110 having access to servers (112, 114). The network can be part of the Internet, the worldwide collection of computers, networks and gateways that use the TCP/TP suite of protocols to communicate with one another. The Internet provides a backbone of high-speed data communication lines between major nodes or host computers, consisting of thousands of commercial, government, educational, and other computer systems, that route data and messages. Servers (112,114) connected to the network 110 can host content for display on computer 100. The content can include specially formatted Web pages hosted on a Web server 114 connected to the network 110. Figure 2 shows the internal structure of the computer of Figure 1. The computer 100 contains a system bus 204, a bus is a set of hardware lines used for data transfer among the components of a computer system. A bus is essentially a shared highway that connects different parts of the system (e.g., processor, disk-drive controller, memory, and input/output ports) which enables the different parts to transfer information. Attached to system bus 204 is display interface 206, display interface 206 allows display 106 to communicate with other components on system bus 204. Keyboard interface 208 and mouse interface 210 are also attached to system bus 204 and allows the input devices to communicate with other components on system bus 204. Network interface 212 provides the link to an external network (e.g., network 110) allowing processes running on computer 100 to communicate with servers (112,114) connected to a network 110. A memory 200 can store computer software instructions and data structures used to implement an embodiment of the present invention. A processor 202 executes instructions stored in memory 200, allowing the computer 100 to process and display Web content, including stractured text. In a system displaying content it is often desirable to represent that content using an object-oriented paradigm, in which a system is viewed as a collection of discrete objects that are self-contained collections of data structures and routines having the ability to interact with other objects in the system. Object-oriented systems provide for the definition of classes that can be used to create (instantiate) objects of that class. The objects allow for the encapsulation of data and provide well defined interfaces for other objects to use when sending data to, or receiving data from, an object. One class definition can inherit (subclass) the capabilities of another, allowing more complex classes to be build from simpler, underlying classes. Classes, as used in this description, are allowed to be subclasses of themselves. The classes can also specify certain behaviors that are only fully defined at run-time. The combination of features provided in object-oriented systems create a platform for delivering flexible and scalable content development and display systems.
Programs written using the Curl computer programming language can be notified of the occurrence of various events of interest by means of an event mechanism. Events often occur as a result of user interaction, such as pressing a key on the keyboard, moving the pointer across the display screen, or clicking a mouse button on a graphical object. Not all events are a result of outside interaction; the Curl run-time itself can also explicitly instantiate events. When a particular type of event occurs, an event object of that type is instantiated.
In one preferred embodiment of the present invention classes are defined for an Event, an EventTarget and an EventHandler. The following description contains examples of programming concepts of the present invention in pseudocode. This code resembles the Curl computer programing language, but is not intended to conform to the syntax of any existing language. The pseudocode is presented to illustrate concepts, not define implementation details. Example implementations of
Event, EventTarget and EventHandler classes follow.
The Event class represents an interaction that occurs within the computer system that is meant to be communicated to objects within the computer system. Events can be created and fired as a result of external interaction (e.g., a key press) or created explicitly (e.g., because a timer expired). Events can represent actions taken in the past, actions currently being taken, or actions to taken in the future.
{define-class Event Fields: boolean consumed?;
EventTarget target;
Methods: fireO {
// This method assumes that this.target is already set. set this.consumed? = false; this.target.fire-event-handlers(this); this .fire-methods() ; } fire-methods() {
// subclasses will override this to call the appropriate // static methods, if any; e.g., the KeyPress event will // call this.target.on-key-press(this). } consume() { set this.consumed? = true } }
The EventTarget class provides an object with the ability to receive and process events that may be targeted (fired) at it.
{define-class EventTarget Fields:
EventHandler[] handlers;
Methods: init(EventHandler[] handlers) { for (each handler in handlers) { this.add-event-handler(handler); } add-event-handler(EventHandler handler) { assert(this is subclass of handler.handler-procedure's first argument); this . event-handlers . app end(handler) ;
} remove-event-handler(EventHandler handler) { this .handlers .remo ve(handler) ;
} fire-event-handlers(Event event) { for (each handler in this.handlers) { handler.handler-procedure(event, this) ; }
}
// Common static handlers on-key-press(KeyPress event) { // default implementation does nothing
} }
The EventHandler class provides dynamic handlers (attached at runtime) and static handlers (i.e., methods of EventTarget class) for processing Events. {define-class EventHandler
Fields:
ClassType type-of-event-to-handle; Procedure handler-procedure;
Methods: init(ClassType type-of-event, Procedure procedure) { assert(type-of-event is a subclass of Event); assert(procedure takes two arguments); assert(event-class is a subclass of procedure's first argument); assert(procedure's second argument is a subclass of
EventTarget); assert(procedure has zero return values); set this.type-of-event-to-handle = type-of-event; set this. handler-procedure = procedure; } typecheck-potential-target(EventTarget target) { assert(target is a subclass of type-of-event's target type);
} fire(Event e) { handler-procedure(e); } cloneO { return new EventHandler(this.type-of-event-to-handle, this.handler-procedure); } }
Although Event represents the existence of an event, its mere existence does not mean that the event is occurring. Because events can be occurring now, may have occurred in the past, or may occur in the future, a Curl Event can represent an event occurring in various time frames. The actual occurrence of the event is represented by calling the fire method on an Event; this is known as firing the event. Generally, Events are created, fired, then released, but this sequence is not required. Curl objects are allowed to store Event objects (previously fired or not), fire an Event more than once, or create and release an Event without ever firing it.
The firing of an Event does not occur blindly; instead, the event is fired at a specific target. The target must be a subclass of the EventTarget class. The Event can be fired at more than one object by changing the target and refiring it. Some Event types are processed by an algorithm that searches for targets and fires the Event at each of the found targets.
Each EventTarget has a (possibly empty) set of EventHandlers that may process the event. Each handler will only process events of a specific Event class, or subclasses of that class. A handler for events of type Event will process all events fired at the EventTarget, since all events must be subclasses of Event.
There are two types of EventHandlers: static and dynamic. Static EvenHandlers are simply methods of EventTarget. It is the responsibility of each Event subclass to call the appropriate static EventHandler methods on the target. For some types of Events, there maybe no static handlers that are appropriate; for others, there may be several. The predefined Event types are associated with particular static EventHandlers; for example, the KeyPress event will call the on-key-press() method on the EventTarget. The default static event handlers on EventTarget perform no action; they are merely placeholders for subclasses to provide their own handlers by overriding the methods.
Dynamic EventHandlers are not intrinsic to the EventTarget, but can added to, or removed from, the EventTarget at runtime. Conceptually, dynamic EventHandlers are procedures stored on the dynamic event handler list of the
EventTarget and are only called for events of a specific class (or subclasses of that class). There can be more than one dynamic EventHandler for the same Event on a target, and there can be a dynamic EventHandler for an Event that also has a static handler on the same EventTarget. The order in which the dynamic EventHandlers are called on an EventTarget may be undefined, although all dynamic EventHandlers for an Event will be called before the static EventHandler (if any) is called.
An EventHandler can perform its specified task and also request that other handlers not act on that specific event by consuming the event it handles. One way to indicate that an EventHandler has consumed an Event is to set a flag on the Event. A mechanism for enforcing this convention is not required within Event,
EventTarget, or EventHandler, although there are specific algorithms within the Curl run-time that use this mechanism to stop searching for new targets at which to fire an Event if the Event has been consumed.
Each EventTarget keeps a list of its EventHandlers. EventHandlers are added to an EventTarget through the add-event-handler method(). In addition to this, EventTarget provides a mechanism for adding dynamic event handlers when creating the EventTarget. The intialization method of EventTarget takes a variable number of parameters: for each parameter that is of type EventHandler, the EventTarget will call add-event-handler() on itself, passing the initialization parameter as the argument to add-event-handler(). Since any class' initialization method can pass its parameters to the initialization method of its superclass, it is very simple for any subclass of EventTarget to accept EventHandlers when it is created. This initialization scheme, combined with the use of the ON macro, makes it easy to add a dynamic EventHandler to well-behaved subclasses of EventTarget. When an Event is fired at an EventTarget, the EventTarget considers each EventHandler on its list. If the EventHandler is defined to handle that type of event, its procedure is called with the Event as its first argument, and the EventTarget as its second argument. The event mechanism allows for all of the EventHandlers on the list to be considered, even if the Event is consumed.
Figure 3 illustrates the class hierarchies defined in an embodiment of the present invention. The Object class 350 is a base class for all other classes and is implicit in their definition. Event class 352 is a subclass of Object Class 350, Event class 352 is a parent class to WindowEvent (e.g., PointerPress, KeyPress) and SelectionEvent. BasicEventTarget class 354 contains methods used internally by an event queuing mechanism and is a parent of EventTarget class 356. EventTarget class 356 allows EventHandlers to be attached to objects and allows Events to be fired at those objects. Visual Class 358 inherits from the EventForwarder class and is part of the internal mechanism for dispatching pointer events. The Element class 360 is the parent of StructualElement and TextElement class 362. The EventHandler class 364 supports the processing of Event types using executable code to act upon the EventTarget.
Figure 4 illustrates the objects and object interactions of an embodiment of the present invention. In a generic example, an Object 300 fires an Event 302 at an EventTarget 306. In this example, StracturedText 304 object has subclassed EventTarget 306. EventTarget 306 invokes EventHandler 308 to process the Event 302. EventHandler 308 calls static methods 310 (i.e., those defined in the class definition) and dynamic procedures 312 (i.e., those added dynamically) on EventHandler 308. These static methods 310 and dynamic procedures 312 act on StracturedText 304 to effect the actions associated with Event 302 on StracturedText 304. In a more specific example, dynamic event handlers for structured text can be used to process a command to capitalize a portion of text in a content display system. The base Event classes described above can be extended to more closely capture the semantics of a particular event (e.g., capitalization). An Event and EventHandler are defined, the EventHandler is then attached to a stractured text object and invoked to perfoπn the capitalization. Using an object-oriented approach, the class, CapitalizeEvent, is defined as a subclass of Event. The underlying Event class provides the basics of event processing. A CapitalizeEvent object can define a more specific target type, TextElement, for the CapitalizeEvent to be fired at. A CapitalizeHandler instance can also be created to perform the actual capitalization on the text. For example:
// create an event handler for the event type
EventHandler CapitalizeHandler set CapitalizeHandler =
{on CapitalizeEvent do // // actual code to capitalize the first letter of
// the first word in every sentence goes here... // • }
Once the Event and EventHandler are defined, the EventHandler is attached to an EventTarget (e.g. the structured text object defined by TextElement) to enable the Event to be fired.
The EventHandler can be added to the stractured text object after the structured text object has been created, using a method provided for associating
EventHandlers with EventTargets. For example: let Para = {paragraph "this application will be filed in the united states patent and trademark office."} Para.add-event-handler(CapitalizeHandler);
The EventHandler can be added to the structured text object when it is created. For example: {paragraph "this application will be filed in the united states patent and trademark office." {value CapitalizeHandler}} The EventHandler can be also added to the stractured text object when it is created, providing the actual code at the same time. For example:
{paragraph "this application will be filed in the united states patent and trademark office." {on CapitalizeEvent do
//
// actual code to capitalize the first letter of // the first word in every sentence goes here...
} }
Once an EventHandler is attached to the structured text object, the
EventHandler can be invoked by firing an Event at the EventTarget. In this example the capitalization action is initiated by pressing the Ctrl-C key on the keyboard. For example: if (KeyPress = <confrol-c>) { // if Ctrl-C
CapitalizeEvent c; // declare a Capitalize event set c = new CapitalizeEvent(); // instantiate a Capitalize event for (each paragraph in a document) { // select a paragraph set c.consumed? = false // set to not consumed set c.target = paragraph // point the event at the paragraph c.fire(); // fire the event at the paragraph
} }
Attaching the EventHandler and firing the Event that causes the
EventHandler to be invoked can be combined by providing executable code during the attachment process. One preferred embodiment uses the ON macro to process a
PointerPress event. For example:
{paragraph "click on me to capitalize each sentence." {on e:PointerPress do
CapitalizeEvent c; set c = {new CapitalizeEvent} set c.target = e.target c.fireO; } }
The creation of a dynamic EventHandler has two steps: 1) writing the code for the handler, and 2) attaching the handler to a target.
An EventHandler can be defined directly using the "define-proc" mechanism. For example, using the CapitalizeEvent discussed above, an EventHandler can be defined follows:
{define-proc capitalize-handler (CapitalizeEvent event, EventTarget target) { //
// actual code to capitalize the first letter of // the first word in every sentence goes here...
} let handler:EventHandler set handler = new EventHandler(CapitalizeEvent, capitalize-handler);
The Curl computer programming language also provides an ON macro to assist in writing the EventHandler code. Although use of the ON macro is not required it can simplify the creation of dynamic event handlers. There are several ways in which one can use the ON macro. An example of the simplest form of the ON macro is:
{on <event-type> do <body>
} where <event-type> specifies the class of event to handle, and <body> specifies the actual event handler code.
Other variations allow you to use variables to set the event target, for example:
{on <event-var>:<event-type> do
<body> }
{on <event-var>:<event-type> at <target-var>:<target-type> do
<body> } {on <event-type> at <target-var>:<target-type> do <body>
} where <event-type> specifies the class of event to handle, <event-var> is the name of a variable that will contain the instance of the event that was fired, <target-type> specifies the class of event target onto which the handler will be attached,
<target-var> is the name of a variable that will contain the instance of the target at which the event was fired, and <body> is the actual event handler code. The handler will also be called for events that are subclasses of <event-type>, and that the handler can be attached to objects that are subclasses of <target-type>.
When the code has been predefined in a procedure, the ON macro can be used to directly invoke the procedure upon the occurrence of the event, for example:
{on <event-type> invoke <proc>
} where <proc> is a procedure of no parameters that contains the event handler code.
The ON macro creates and returns an object of type EventHandler. An object of this type can also be created directly. The initializer function for the
EventHandler class takes two parameters: the type of event to handle, and a procedure to call when the handler is invoked. The procedure takes two parameters: an Event and an EventTarget.
Figure 5 is a flowchart of the process of providing executable code for processing an event type in the implementation of the ON macro. The process starts at step 402. The variables used in the process: <event-var>, <event-type>, <target-var>, <target-type>, <body>, and <proc> are initialized to null at step 402. Step 404 parses the next expression. Step 406 determines if the expression is an identifier. If it is, Step 408 sets the variable <event-type> to that identifier; otherwise, Step 410 determines if the expression is a pair of a name and an identifier. If it is, Step 412 sets the variable <event-var> to the name and the variable <event-type> to the identifier; otherwise Step 414 throws an error and execution exits. Step 412 and Step 408 both proceed to Step 416.
Step 416 parses the next expression. Step 418 determines if the expression is the word "at". If it is, execution proceeds to Step 420; otherwise, execution jumps to Step 432. Step 420 parses the next expression. Step 422 determines if the expression is an bidentifier. If it is, Step 424 sets the variable <target-type> to that identifier; otherwise, Step 426 determines if the expression is a pair of a name and an identifier. If it is, Step 428 sets the variable <target-var> to the name and the variable <target-type> to the identifier; otherwise Step 430 throws an error and execution exits. Step 424 and Step 428 both proceed to Step 432.
Step 432 parses the next expression. Step 434 determines if the expression is the word "do". If it is, execution proceeds to Step 434; otherwise, Step 436 throws an error and execution exits. Step 434 stores the remaining expressions in <body>. Step 438 determines if <event-var> is null. If it is, Step 440 generates a unique name and sets <event-var> to it; in either case, execution proceeds to Step 442. Step 442 determines if <target-var> is null. If it is, Step 444 generates a unique name and sets <target-var> to it; in either case, execution proceeds to Step 446. Step 446 determines if <target-type> is null. If it is, Step 448 sets <target-type> to EventTarget; in either case, execution proceeds to Step 450.
Step 450 creates a new procedure and sets <proc> to it. This procedure has an argument named <event-var> of type <event-type>, and an argument named <target-var> of type <target-type>. The body of the procedure is <body>. Step 452 creates and returns an EventHandler with arguments <event-type> and <proc>. Step 454 is the end.
Other example uses for dynamic event handlers on structured text include: a TranslateEventHandler that looks up the text in a language translation dictionary and pops up a window displaying the results. An ExecuteEventHandler can invoke the Curl just-in-time compiler on the text; if the text was valid Curl code, the compiled program would be executed. An AnimateEventHandler might adjust the appearance of the rendered text, not the content, with each firing, by updating a marquee that marches around each glyph. A FindDocumentationEventHandler might pop up a documentation system and perform a query using the selected text.
While this invention has been particularly shown and described with references to preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the scope of the invention encompassed by the appended claims.

Claims

CLATMSWhat is claimed is:
1. A method of defining dynamic event handlers for stractured text comprising the steps of: defining an event type; creating, at run-time, an event handler responsive to the event type; and associating the event handler with the stractured text.
2. The method of Claim 1 further comprising the step of: invoking the event handler associated with the structured text.
3. The method of Claim 2 wherein: the event type is used to select which of the created event handlers to invoke.
4. The method of Claim 1 wherein: the step of defining an event type occurs at run-time.
5. The method of Claim 1 wherein: the event handler sets an indication that the event type has been consumed, allowing other event handlers to forgo processing the event type.
6. The method of Claim 1 wherein: the event handler is provided as a reference to an invokable procedure that contains executable code.
7. The method of Claim 1 wherein: the event handler is provided by using a macro having an event type parameter and an executable code parameter.
8. The method of Claim 7 wherein the macro further comprises having an event type variable name parameter.
9. The method of Claim 7 wherein the macro further comprises having a stractured text reference variable name parameter.
10. A method enabling the definition of dynamic event handlers for stractured text comprising the steps of: providing a function to define event types; enabling the creation, at run-time, of an event handler responsive to the event type; and providing an association of the event handler with the structured text.
11. A method of defining and invoking dynamic event handlers for structured text comprising the steps of: creating an obj ect of an obj ect class capable of firing events; creating an event object of an event class capable of specifying an event type; creating a structured text object of a stractured text class capable of representing content, the structured text object being enabled to interact with the event type; creating, at run-time, an event handler object of an event handler class capable of processing the event type for the stractured text object; and causing the object to fire the event object at the structured text object, the stractured text object invoking the event handler object associated with the event type specified in the event object.
12. An apparatus for creating dynamic event handlers for structured text comprising: an event type; an event handler, created at run-time, responsive to the event type; and a connection between the event handler and the stractured text.
13. The apparatus of Claim 12 wherein: the event handler associated with the structured text is invoked.
14. The apparatus of Claim 13 wherein: the event type is used to select which of the created event handlers to invoke.
15. The apparatus of Claim 12 wherein: the event type is defined at run-time.
16. The apparatus of Claim 12 wherein: the event handler sets an indication that the event type has been consumed, allowing other event handlers to forgo processing the event type.
17. The apparatus of Claim 12 wherein: the event handler is provided as a reference to an invokable procedure that contains executable code.
18. The apparatus of Claim 12 wherein: the event handler is provided using a macro having an event type parameter and an executable code parameter.
19. The apparatus of Claim 18 wherein the macro further comprises: an event type variable name parameter.
20. The apparatus of Claim 18 wherein the macro further comprises: a stractured text reference variable name parameter.
21. An apparatus for defining and invoking dynamic event handlers for structured text comprising: an object of an object class capable of firing events; an event object of an event class capable of specifying an event type; a stractured text object of a structured text class capable of representing content, the stractured text object enabled to interact with the event type; an event handler object of an event handler class, created at run-time, capable of processing the event type for the structured text object; and wherein the object fires the event object at the stractured text object, the structured text object invoking the event handler object associated with the event type specified in the event object.
22. An apparatus for defining dynamic event handlers for stractured text comprising: a means for defining an event type; a means for creating, at run-time, an event handler responsive to the event type; and a means for associating the event handler with the structured text.
23. A computer program product comprising : a computer usable medium for defining dynamic event handlers for stractured text; a set of computer program instructions embodied on the computer usable medium, including instructions to: define an event type; create, at run-time, an event handler responsive to the event type; and associate the event handler with the structured text.
24. A propagated signal carried on an electromagnetic waveform, the signal comprising a set of computer program instructions to: define an event type; create, at run-time, an event handler responsive to the event type; and associate the event handler with the stractured text.
PCT/US2001/029318 2000-09-22 2001-09-19 Dynamic event handlers for structured text WO2002025431A2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
AU2001291123A AU2001291123A1 (en) 2000-09-22 2001-09-19 Dynamic event handlers for structured text

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US66747200A 2000-09-22 2000-09-22
US09/667,472 2000-09-22

Publications (2)

Publication Number Publication Date
WO2002025431A2 true WO2002025431A2 (en) 2002-03-28
WO2002025431A3 WO2002025431A3 (en) 2003-02-06

Family

ID=24678368

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/US2001/029318 WO2002025431A2 (en) 2000-09-22 2001-09-19 Dynamic event handlers for structured text

Country Status (2)

Country Link
AU (1) AU2001291123A1 (en)
WO (1) WO2002025431A2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7966287B2 (en) 2008-05-15 2011-06-21 International Business Machines Corporation Apparatus, system, and method for dynamic database driven document synchronization
WO2011102935A1 (en) * 2010-02-22 2011-08-25 Brignoli Winthrop A Systems and methods for message-based distributed computing
US9529648B2 (en) 2009-06-26 2016-12-27 International Business Machines Corporation Generic declaration of bindings between events and event handlers regardless of runtime structure
WO2019147387A1 (en) * 2018-01-25 2019-08-01 Microsoft Technology Licensing, Llc Framework for contextual notifications

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0727741A1 (en) * 1995-01-19 1996-08-21 International Business Machines Corporation Method and system for managing events
US5794257A (en) * 1995-07-14 1998-08-11 Siemens Corporate Research, Inc. Automatic hyperlinking on multimedia by compiling link specifications

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0727741A1 (en) * 1995-01-19 1996-08-21 International Business Machines Corporation Method and system for managing events
US5794257A (en) * 1995-07-14 1998-08-11 Siemens Corporate Research, Inc. Automatic hyperlinking on multimedia by compiling link specifications

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7966287B2 (en) 2008-05-15 2011-06-21 International Business Machines Corporation Apparatus, system, and method for dynamic database driven document synchronization
US9529648B2 (en) 2009-06-26 2016-12-27 International Business Machines Corporation Generic declaration of bindings between events and event handlers regardless of runtime structure
WO2011102935A1 (en) * 2010-02-22 2011-08-25 Brignoli Winthrop A Systems and methods for message-based distributed computing
US8250090B2 (en) 2010-02-22 2012-08-21 Brignoli Winthrop A Method for performing message-based distributed computing, involves executing expression of matched message response on members identified by set instance definition using dimension values derived from message
WO2019147387A1 (en) * 2018-01-25 2019-08-01 Microsoft Technology Licensing, Llc Framework for contextual notifications
US10754502B2 (en) 2018-01-25 2020-08-25 Microsoft Technology Licensing, Llc Framework for contextual notifications

Also Published As

Publication number Publication date
WO2002025431A3 (en) 2003-02-06
AU2001291123A1 (en) 2002-04-02

Similar Documents

Publication Publication Date Title
Gosling et al. The Java language environment
US6675230B1 (en) Method, system, and program for embedding a user interface object in another user interface object
US7269792B2 (en) System and method for generating high-function browser widgets with full addressability
JP3650363B2 (en) Method and system for loading XML data
US20060149746A1 (en) Web application communication protocol
US7730499B2 (en) Protocol agnostic request response pattern
US20060167981A1 (en) Web application architecture
US6877163B1 (en) Method and system for dynamic proxy classes
EP1156427A2 (en) Postback input handling by server-side control objects
US20020101448A1 (en) Generating a declarative user interface
KR20050039551A (en) Programming interface for a computer platform
WO2002097573A2 (en) Method and apparatus for generating source code
US7124399B2 (en) Document/view application development architecture applied to ActiveX technology for web based application delivery
JP2002049484A (en) Server side control object for processing client side user interface element
KR101145476B1 (en) Method and system for creating and providing a multi-tier networked service
US5991538A (en) System for generating and using programs in an object-oriented environment with a message dispatch architecture
EP1677488A1 (en) Web application architecture
US8069438B2 (en) Class declaration in a non-class-based programming environment
US7165243B1 (en) Multi-lingual tag extension mechanism
US20070136658A1 (en) Handling events in a descriptive context
WO2002025431A2 (en) Dynamic event handlers for structured text
US7343391B2 (en) System and method for interprocess services client artifact download
Puder A cross-language framework for developing ajax applications
Manola Some Web Object Model Construction Technologies
Aprea et al. Validation Control

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A2

Designated state(s): AE AG AL AM AT AU AZ BA BB BG BR BY BZ CA CH CN CO CR CU CZ DE DK DM DZ EC EE ES FI GB GD GE GH GM HR HU ID IL IN IS JP KE KG KP KR KZ LC LK LR LS LT LU LV MA MD MG MK MN MW MX MZ NO NZ PH PL PT RO RU SD SE SG SI SK SL TJ TM TR TT TZ UA UG UZ VN YU ZA ZW

AL Designated countries for regional patents

Kind code of ref document: A2

Designated state(s): GH GM KE LS MW MZ SD SL SZ TZ UG ZW AM AZ BY KG KZ MD RU TJ TM AT BE CH CY DE DK ES FI FR GB GR IE IT LU MC NL PT SE TR BF BJ CF CG CI CM GA GN GQ GW ML MR NE SN TD TG

121 Ep: the epo has been informed by wipo that ep was designated in this application
REG Reference to national code

Ref country code: DE

Ref legal event code: 8642

122 Ep: pct application non-entry in european phase
NENP Non-entry into the national phase in:

Ref country code: JP