|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.smartgwt.client.util.EventHandler
public class EventHandler
The ISC system provides a predictable cross-browser event-handling mechanism for ISC widgets. Events can be handled both at the page level (i.e., globally), and at the level of individual widgets.
With the exception of a few page-specific events ('load', 'unload', 'idle' and 'resize'), events are processed in the following sequence:
1. The event is sent to any global (page-level) event handlers. These handlers can cancel
further propagation of the event by returning false. You can register to listen for any of the
events linked in the seeAlso section (below) by calling com.smartgwt.client.util.Page#setEvent
method.
2. If the event occurred on a form element or a link, it is passed on to the browser so that the element will perform its default action. No widget receives the event.
3. If the event occurred on an enabled widget (but not on a form element or link inside
the widget), it is sent to that widget's event handler, if any. This handler can cancel
further propagation of the event by returning false. An "enabled" widget is any widget that
defines an event handler for one of the supported events. Interceptable events are defined in
the com.smartgwt.client..Canvas#methods#events
.
4. The event is "bubbled" up to the widget's parent in the containment hierarchy, if any. Again, the parent's handler for the event can cancel further propagation by returning false. This step is repeated, with the event "bubbling" up through the containment hierarchy, until a top-level widget is reached or the event is explicitly canceled. In brief, the ISC event model offers the best features of browser event models:
SmartGWT libraries will not interfere with native event handling when events occur outside of a target widget. You can therefore have HTML that is not ISC-based on the same page as widget objects that will react to native events as you would expect.
You can use isc.Event as an alias for isc.EventHandler.
Constructor Summary | |
---|---|
EventHandler()
|
Method Summary | |
---|---|
static java.lang.Boolean |
altKeyDown()
Return true if the alt (option) key is being held down. Note that this is only set reliably for keyboard events. |
static java.lang.Boolean |
ctrlKeyDown()
Return true if the control key is being held down. Note that this is only set reliably for keyboard events. |
Rectangle |
getDragRect()
During a drag with dragAppearance of either "target" or "outline", returns the page-relative coordinates of whatever element is being dragged. |
static Canvas |
getDragTarget()
Returns the current dragTarget. |
static java.lang.String |
getKey()
Return the name of the key for the event passed in. |
static java.lang.Integer |
getMouseDownX()
Return the page-relative X (horizontal) coordinate of an event. |
static java.lang.Integer |
getMouseDownY()
Return the page-relative Y (vertical) coordinate of an event. |
static Canvas |
getTarget()
Return the canvas that is the target of the mouse event. Returns null if no canvas found. |
static int |
getWheelDelta()
Applies to Canvas.addMouseWheelHandler(com.smartgwt.client.widgets.events.MouseWheelHandler) events only.
Returns an integer indicating how far the mouse wheel was rotated. |
static int |
getX()
Return the page-relative X (horizontal) coordinate of an event. |
static int |
getY()
Return the page-relative Y (vertical) coordinate of an event. |
static java.lang.Boolean |
leftButtonDown()
Returns true if the left mouse button is being pressed. |
static java.lang.Boolean |
rightButtonDown()
Returns true if the right mouse button is being pressed. |
static void |
setDragTracker(java.lang.String html)
Set the HTML for the drag tracker that follows the mouse during a drag and drop interaction. |
static void |
setDragTracker(java.lang.String html,
int newWidth,
int newHeight,
int offsetX,
int offsetY)
Set the HTML for the drag tracker that follows the mouse during a drag and drop interaction. |
static java.lang.Boolean |
shiftKeyDown()
Return true if the shift key is being held down. Note that this is only set reliably for keyboard events. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventHandler()
Method Detail |
---|
public static int getWheelDelta()
Canvas.addMouseWheelHandler(com.smartgwt.client.widgets.events.MouseWheelHandler)
events only.
Returns an integer indicating how far the mouse wheel was rotated. This value will be
positive if the user scrolled the mousewheel forward or up, or negative if scrolled in the
other direction and will be a multiple of 1 where 1 indicates the smallest possible rotation
of the wheel.
public static Canvas getTarget()
public static Canvas getDragTarget()
public static int getX()
public static int getY()
public static java.lang.Boolean leftButtonDown()
public static java.lang.Boolean rightButtonDown()
public static java.lang.Boolean shiftKeyDown()
public static java.lang.Boolean ctrlKeyDown()
public static java.lang.Boolean altKeyDown()
public static void setDragTracker(java.lang.String html)
Your canvas can use this routine to set the drag tracker to whatever HTML you want like so:
dragStart : function () { isc.EventHandler.setDragTracker('Your contents here'); }
html
- HTML for the trackerpublic static void setDragTracker(java.lang.String html, int newWidth, int newHeight, int offsetX, int offsetY)
Your canvas can use this routine to set the drag tracker to whatever HTML you want like so:
dragStart : function () { isc.EventHandler.setDragTracker('Your contents here'); }
html
- HTML for the trackernewWidth
- new width for the trackernewHeight
- new height for the trackeroffsetX
- x-offset for the trackeroffsetY
- y-offset for the trackerpublic Rectangle getDragRect()
public static java.lang.Integer getMouseDownX()
public static java.lang.Integer getMouseDownY()
public static java.lang.String getKey()
Strings to identify the various keys on the keyboard. For alpha keys, the single (uppercase) character value is used, such as "Q" For Numeric keys, the number is used as in a single character string, like "1" Function keys are identified as "f1" - "f12" Non alpha-numeric character keys (such as the key for "[" / "{") are identified by their unmodified character value (the value obtained by hitting the key without holding shift down), by default - exceptions are listed below. Additional key names: - Space - Tab - Enter - Escape - Backspace - Insert - Delete - Arrow_Up - Arrow_Down - Arrow_Left - Arrow_Right - Home - End - Page_Up - Page_Down - Shift - Ctrl - Alt [Note: Some keys may not be available for capture on every platform]
KeyNames
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |