use of com.google.gwt.user.client.EventListener in project rstudio by rstudio.
the class ChunkContextToolbar method initOptions.
// Private methods ---------------------------------------------------------
private void initOptions(boolean dark) {
options_.setResource(new ImageResource2x(dark ? RES.chunkOptionsDark2x() : RES.chunkOptionsLight2x()));
DOM.sinkEvents(options_.getElement(), Event.ONCLICK);
DOM.setEventListener(options_.getElement(), new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (DOM.eventGetType(event) == Event.ONCLICK) {
host_.showOptions(event.getClientX(), event.getClientY());
}
}
});
}
use of com.google.gwt.user.client.EventListener in project gerrit by GerritCodeReview.
the class SideBySideChunkManager method focus.
private static void focus(NativeEvent event, DisplaySide side) {
Element e = Element.as(event.getEventTarget());
for (e = DOM.getParent(e); e != null; e = DOM.getParent(e)) {
EventListener l = DOM.getEventListener(e);
if (l instanceof SideBySide) {
((SideBySide) l).getCmFromSide(side).focus();
event.stopPropagation();
}
}
}
use of com.google.gwt.user.client.EventListener in project gwt-test-utils by gwt-test-utils.
the class DOMImplPatcher method dispatchEvent.
@PatchMethod
static void dispatchEvent(Object domImpl, Element target, NativeEvent evt) {
EventListener listener = DOM.getEventListener(target);
if (listener != null && evt instanceof Event) {
listener.onBrowserEvent((Event) evt);
}
// dispatch to parent if needed
boolean propagationStopped = JavaScriptObjects.getBoolean(evt, JsoProperties.EVENT_IS_STOPPED);
if (target.getParentElement() != null && propagationStopped) {
target.getParentElement().dispatchEvent(evt);
}
}
use of com.google.gwt.user.client.EventListener in project gwt-test-utils by gwt-test-utils.
the class Browser method click.
/**
* Simulates a click event.
*
* @param target
* The targeted Element.
*/
public static void click(Element target) {
EventListener eventListener = getEventListener(target);
click((IsWidget) eventListener, target);
}
use of com.google.gwt.user.client.EventListener in project gwt-test-utils by gwt-test-utils.
the class Browser method dispatchEvent.
public static void dispatchEvent(Element element, Event event) {
canApplyEvent(element, event);
prepareEvents(element, event);
// set the related target
Element relatedTargetElement = JavaScriptObjects.getObject(event, JsoProperties.EVENT_RELATEDTARGET);
if (relatedTargetElement == null) {
switch(event.getTypeInt()) {
case Event.ONMOUSEOVER:
case Event.ONMOUSEOUT:
relatedTargetElement = element.getParentElement();
JavaScriptObjects.setProperty(event, JsoProperties.EVENT_RELATEDTARGET, relatedTargetElement);
break;
}
}
// For preview event handling
GwtReflectionUtils.callStaticMethod(DOM.class, "previewEvent", event);
Element currentElement = element;
EventListener currentEventListener = DOM.getEventListener((com.google.gwt.user.client.Element) element);
Set<EventListener> applied = new HashSet<EventListener>();
while (currentElement != null && !isEventStopped(event)) {
// for app event handling
if (currentEventListener != null && !applied.contains(currentEventListener)) {
applied.add(currentEventListener);
GwtReflectionUtils.callStaticMethod(DOM.class, "dispatchEvent", event, currentElement, currentEventListener);
}
currentElement = currentElement.getParentElement();
if (currentElement != null) {
currentEventListener = DOM.getEventListener((com.google.gwt.user.client.Element) currentElement);
} else {
currentEventListener = null;
}
}
}
Aggregations