[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

[WI8] WI8Object

The base class for any WI8 widget object.

WI8 objects are prepared to deal with DOM events and have a handle which usually refers to a DOM element (a NativeObject).
This is the first level of wrapping. Wrapped NativeObjects have themselves a (potentially alien, non-smalltalk) handle which serve as the second level of wrapping to reach the javascript level in an encapsulated fashion.
WI8Objects shouldn't be involved with this second level of wrapping and deal with the 1st level only for specialization of widgets in different platforms.
However WI8Objects can reach the second level wrapped HTML handlers via the message #htmlHandle and #domEventHandler (see Methods below).

Hierarchy

In order for WI8Object to be capable of handling Smalltalk events it inherits from EventManager.

Instance Variables

handlea handle which usually refers to a DOM element (a NativeObject). This is the first level of visualization wrapping

Relevant Methods

Class

@ aHandleCreates a WIObject (or subclass) with a web handle (usually an object from the DOM class hierarchy (a NativeObject))
librariesReturns the list of known external libraries (eg. the U8 server base url)
resourcesLocal misc resources (eg. local images)

Instance

domEventHandlerReturns the 2nd level wrapped object (usually an alien, js object involved in widget visualization at the js level)
handleReturns the handle of the receiver (usually an object on the DOM class hierarchy (a NativeObject))
htmlHandleSame as #domEventHandler above
registerDOMEvent: onSelector doing: closureRegisters an action (closure) for a specific DOM event selector (onSelector)
registerEvent: anEvent doing: closureRegisters an action (closure) for a specific DOM event (anEvent)
when: anEvent evaluate: anActionShortcut to register anAction to the be evaluated when the receiver triggers the event. Relies on #registerEvent:doing: described above


Events

WI8Object can handle the following events:

domEventsThe list of DOM events managed by WI8Object is empty since this method can be refined by subclasses to handle them
formEventsDefines DOM event names handled by web forms
frameEventsDefines DOM event names handled by web frames
keyboardEventsDefines DOM event names coming from keyboard input
localEventsReturns the receiver smalltalk events. This class defines needsUrlFor:fileName: which is potentially triggered when the #urlFor:image: message is received to find the url of a file
mouseEventsDefines DOM event names coming from mouse input
objectEventsSame as #frameEvents above
touchEventsDefines DOM event names coming from touch input

References