|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.extjs.gxt.ui.client.event.BaseEvent
com.extjs.gxt.ui.client.event.DomEvent
public class DomEvent
A BaseEvent
that wraps a browser event and provides a set of DOM
related method.
Button btn = new Button(); btn.addListener(Event.ONCLICK, new Listener<ButtonEvent>() { public void handleEvent(ButtonEvent be) { // ButtonEvent is a DomEvent subclass // retrieve the event target Element target = be.getTarget(); // get the mouse location Point point = be.getXY(); // is the control key pressed? boolean control = be.isControlKey(); // cancel event bubbling be.cancelBubble(); } });
Field Summary | |
---|---|
protected com.google.gwt.user.client.Event |
event
|
Constructor Summary | |
---|---|
DomEvent(java.lang.Object source)
Creates a new base event. |
|
DomEvent(java.lang.Object source,
com.google.gwt.user.client.Event event)
Creates a new base event. |
Method Summary | |
---|---|
void |
cancelBubble()
Cancels bubbling for the given event. |
int |
getClientX()
Returns the event's x coordinate. |
int |
getClientY()
Returns the event's y coordinate. |
com.google.gwt.user.client.Event |
getEvent()
Returns the dom event. |
int |
getEventTypeInt()
Returns the dom event type int. |
int |
getKeyCode()
Returns the key code associated with this event. |
com.google.gwt.user.client.Element |
getTarget()
Returns the event's target element. |
El |
getTarget(java.lang.String selector,
int maxDepth)
Returns the matching parent using the specified selector. |
El |
getTargetEl()
Returns the event's target element. |
Point |
getXY()
Returns the mouse location. |
boolean |
hasModifier()
Returns true if the control, alt, shift, or meta key is
pressed. |
boolean |
isAltKey()
Returns true if the alt key is pressed. |
boolean |
isControlKey()
Returns true if the control key (or meta key) is pressed. |
boolean |
isNavKeyPress()
Returns true if the key is a "navigation" key. |
boolean |
isNavKeyPress(int k)
Returns true if the key is a "navigation" key. |
boolean |
isRightClick()
Returns true if the event is a right click. |
boolean |
isShiftKey()
Returns true if the shift key is pressed. |
boolean |
isSpecialKey()
Returns true if the key is a "special" key. |
boolean |
isSpecialKey(int k)
Returns true if the key is a "special" key. |
void |
preventDefault()
Prevents the browser from taking its default action for the given event. |
void |
setEvent(com.google.gwt.user.client.Event event)
Sets the dom event. |
void |
stopEvent()
Stops the event (preventDefault and cancelBubble). |
boolean |
within(com.google.gwt.user.client.Element element)
Returns true if the target of this event equals or is a child
of the given element. |
boolean |
within(com.google.gwt.user.client.Element element,
boolean toElement)
Returns true if the target of this event equals or is a child
of the given element. |
Methods inherited from class com.extjs.gxt.ui.client.event.BaseEvent |
---|
getSource, getType, isCancelled, setCancelled, setSource, setType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected com.google.gwt.user.client.Event event
Constructor Detail |
---|
public DomEvent(java.lang.Object source)
source
- the source objectpublic DomEvent(java.lang.Object source, com.google.gwt.user.client.Event event)
source
- the source objectMethod Detail |
---|
public void cancelBubble()
public int getClientX()
public int getClientY()
public com.google.gwt.user.client.Event getEvent()
public int getEventTypeInt()
public int getKeyCode()
public com.google.gwt.user.client.Element getTarget()
null
if no dom eventpublic El getTarget(java.lang.String selector, int maxDepth)
selector
- the CSS selectormaxDepth
- the maximum number of parents to search
public El getTargetEl()
null
if no dom eventpublic Point getXY()
public boolean hasModifier()
true
if the control, alt, shift, or meta key is
pressed.
public boolean isAltKey()
true
if the alt key is pressed.
public boolean isControlKey()
true
if the control key (or meta key) is pressed.
public boolean isNavKeyPress()
public boolean isNavKeyPress(int k)
k
- the key code
public boolean isRightClick()
true
if the event is a right click.
public boolean isShiftKey()
true
if the shift key is pressed.
public boolean isSpecialKey()
public boolean isSpecialKey(int k)
k
- the key code
public void preventDefault()
public void setEvent(com.google.gwt.user.client.Event event)
event
- the dom eventpublic void stopEvent()
public boolean within(com.google.gwt.user.client.Element element)
true
if the target of this event equals or is a child
of the given element.
element
- the element
public boolean within(com.google.gwt.user.client.Element element, boolean toElement)
true
if the target of this event equals or is a child
of the given element.
element
- the elementtoElement
- true to use NativeEvent.getRelatedEventTarget()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |