Yes, documentation is still forthcoming.

On Fri, Jun 8, 2012 at 3:43 AM, Thomas Broyer <[email protected]> wrote:
>
> Let me clarify: how are native events mapped to DomEvents?
>

The event is guessed from the type of the first parameter in the event
handler. DragStartEvent.getAssociatedType() == "dragstart"


> (DragStartEvent in the sample) probably uses DomEvent.fireNativeEvent, I
> guess.
>

Yes. Actually, AbstractUiRenderer#fireEvent, which calls
DomEvent#fireNativeEvent


> and how are elements matched to the ones in the template? (the "root"
> element in the sample) I suppose the element is somehow retrieved (how?)
> and then isOrHasChild is used to match the event's getEventTarget against
> it.
>

There are two cases. For the outermost element (named "root" in the
example) it is assumed to be a <div> with and attribute
gwtuirendered="123456" either at the root of the Element passed as a
parameter, or nested within. Other ui:field'ed elements, "baz" for example,
will have an id = "123456:baz" so that the getter can find the element by
id.

Event matching walk out from the eleemnt that received the event to
find the outermost element with attribute gwtuirendered and then the
enclosing element that has an id that maps to a handler matching the event
type and a known event handler. See
AbstractUiRenderer#fireEvent, AbstractUiRenderer#findRootElement, and
AbstractUiRenderer#computeDispatchEvent for the details. The generated
UiRenderer contains very little logic, beyond creating the SafeHtml
template.



-- 
Rodrigo Chandia | Software Engineer | [email protected] | 678 7431725

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to