Tell me how to make GWT Custom Event Handler?
Submitted by: AdministratorThis is an event that is triggered when the user becomes happy.
Define a new event class. You can add arbitrary metadata in the event class. For simplicity, we will not include any here though.
public class HappyEvent extends GwtEvent {
...
}
Define a new handler and marker interface for the event class.
interface HappyHandler extends EventHandler {
public void onHappiness(HappyEvent event);
}
interface HasHappyEvents {
public HandlerRegistration addHappyHandler(HappyHandler handler);
}
Add a unique event type
class HappyEvent extends AbstractEvent{
public static AbstractEvent.Key KEY = new AbstractEvent.Key(){...}
public GwtEvent.Key getKey(){
return KEY;
}
...
}
Wire up the handler's fire method
class HappyEvent extends GwtEvent {
static Key KEY = new Key(){
protected void fire(HappyHandler handler, HappyEvent event) {
handler.onHappiness(event);
};
...
}
Submitted by: Administrator
Define a new event class. You can add arbitrary metadata in the event class. For simplicity, we will not include any here though.
public class HappyEvent extends GwtEvent {
...
}
Define a new handler and marker interface for the event class.
interface HappyHandler extends EventHandler {
public void onHappiness(HappyEvent event);
}
interface HasHappyEvents {
public HandlerRegistration addHappyHandler(HappyHandler handler);
}
Add a unique event type
class HappyEvent extends AbstractEvent{
public static AbstractEvent.Key KEY = new AbstractEvent.Key(){...}
public GwtEvent.Key getKey(){
return KEY;
}
...
}
Wire up the handler's fire method
class HappyEvent extends GwtEvent {
static Key KEY = new Key(){
protected void fire(HappyHandler handler, HappyEvent event) {
handler.onHappiness(event);
};
...
}
Submitted by: Administrator
Read Online EXT-GWT Job Interview Questions And Answers
Top EXT-GWT Questions
☺ | What is EXT GWT (Google Web Toolkit)? |
☺ | Explain GWT components? |
☺ | Tell me how to make GWT Custom Event Handler? |
☺ | Basic GWT questions: |
☺ | Explain how GWT Navigation works? |
Top Scripting language Categories
☺ | AngularJS Interview Questions. |
☺ | Ext-JS Interview Questions. |
☺ | Dojo Interview Questions. |
☺ | Expert Developer JavaScript Interview Questions. |
☺ | jQuery Mobile Interview Questions. |