use of com.google.gwt.user.client.EventListener in project rstudio by rstudio.
the class ChunkContextToolbar method initRunPrevious.
private void initRunPrevious(boolean dark) {
runPrevious_.setTitle(RStudioGinjector.INSTANCE.getCommands().executePreviousChunks().getMenuLabel(false));
runPrevious_.setResource(new ImageResource2x(dark ? RES.runPreviousChunksDark2x() : RES.runPreviousChunksLight2x()));
DOM.sinkEvents(runPrevious_.getElement(), Event.ONCLICK);
DOM.setEventListener(runPrevious_.getElement(), new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (DOM.eventGetType(event) == Event.ONCLICK) {
host_.runPreviousChunks();
}
}
});
}
use of com.google.gwt.user.client.EventListener in project gwt-test-utils by gwt-test-utils.
the class WidgetUtils method getWidget.
public static Widget getWidget(Element element) {
while (element != null) {
EventListener eventListener = DOM.getEventListener(element);
if (eventListener != null && eventListener instanceof Widget) {
return (Widget) eventListener;
}
element = element.getParentElement();
}
return null;
}
use of com.google.gwt.user.client.EventListener in project gerrit by GerritCodeReview.
the class UnifiedChunkManager method focus.
private static void focus(NativeEvent event) {
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 Unified) {
((Unified) l).getCmFromSide(DisplaySide.A).focus();
event.stopPropagation();
}
}
}
use of com.google.gwt.user.client.EventListener in project che by eclipse.
the class TargetsViewImpl method renderCategoryHeader.
private SpanElement renderCategoryHeader(final Category<Target> category) {
SpanElement categoryHeaderElement = Document.get().createSpanElement();
categoryHeaderElement.setClassName(commandResources.getCss().categoryHeader());
categoryHeaderElement.appendChild(createMachineLabel(category.getTitle()));
SpanElement textElement = Document.get().createSpanElement();
categoryHeaderElement.appendChild(textElement);
textElement.setInnerText(category.getTitle());
if (machineLocale.targetsViewCategorySsh().equalsIgnoreCase(category.getTitle())) {
// Add button to create a target
SpanElement buttonElement = Document.get().createSpanElement();
buttonElement.appendChild(commandResources.addCommandButton().getSvg().getElement());
categoryHeaderElement.appendChild(buttonElement);
Event.sinkEvents(buttonElement, Event.ONCLICK);
Event.setEventListener(buttonElement, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
event.stopPropagation();
event.preventDefault();
delegate.onAddTarget(category.getTitle());
}
});
} else {
// Add empty span for properly aligning items
categoryHeaderElement.appendChild(Document.get().createSpanElement());
}
return categoryHeaderElement;
}
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);
}
}
Aggregations