Errai 3.0.1-SNAPSHOT

org.jboss.errai.ui.shared.api.annotations
Annotation Type SinkNative


@Inherited
@Documented
@Target(value=METHOD)
@Retention(value=RUNTIME)
public @interface SinkNative

This annotation may only be used in subclasses of Composite that has been annotated with Templated, or in a super-class of said Composite types.

Indicate the types of events to be handled when used in conjunction with a corresponding method that has been annotated with EventHandler; these types are specified using a bit mask in the value() attribute.

Native events on DOM Elements

This use of this annotation does not require that target Element instances be referenced via DataField in the Templated Composite component; they may also target un-referenced data-field elements from the corresponding HTML template.

Example:

 @Templated
 public class QuickHandlerComponent extends Composite
 {
    @DataField
    private AnchorElement link = DOM.createAnchor().cast();
 
    @EventHandler("link")
    @SinkNative(Event.ONMOUSEOVER)
    public void doSomething(Event e)
    {
       // do something
    }
 
    @EventHandler("div")
    @SinkNative(Event.ONCLICK | Event.ONMOUSEOVER)
    public void doSomethingElse(Event e)
    {
       // do something with an element not otherwise referenced in our component
    }
 }
 

See also: EventHandler, Templated, DataField

Author:
Lincoln Baxter, III

Required Element Summary
 int value
          Specifies the types of Event instances that are handled by the annotated handler method.
 

Element Detail

value

public abstract int value
Specifies the types of Event instances that are handled by the annotated handler method. Multiple event types may be handled using a bit-mask of the form:

 @EventHandler("div")
 @SinkNative(Event.ONCLICK | Event.ONMOUSEOVER)
 public void doSomething(Event e)
 {
    // do something
 }
 


Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.