本文整理了Java中com.google.gwt.user.client.Event.setEventListener()
方法的一些代码示例,展示了Event.setEventListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.setEventListener()
方法的具体详情如下:
包路径:com.google.gwt.user.client.Event
类名称:Event
方法名:setEventListener
[英]Sets the EventListener to receive events for the given element. Only one such listener may exist for a single element.
[中]设置EventListener以接收给定元素的事件。单个元素只能存在一个这样的侦听器。
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onAttach() {
super.onAttach();
/*
* Attach the event listener in onAttach instead of onLoad so users cannot
* accidentally override it.
*/
Event.setEventListener(getScrollableElement(), this);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onDetach() {
/*
* Detach the event listener in onDetach instead of onUnload so users cannot
* accidentally override it.
*/
Event.setEventListener(getScrollableElement(), null);
super.onDetach();
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onAttach() {
super.onAttach();
/*
* Attach the event listener in onAttach instead of onLoad so users cannot
* accidentally override it. If the scrollable element is the same as the
* root element, then we set the event listener twice (once in
* super.onAttach() and once here), which is fine.
*/
Event.setEventListener(getScrollableElement(), this);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onDetach() {
/*
* Detach the event listener in onDetach instead of onUnload so users cannot
* accidentally override it.
*/
Event.setEventListener(getScrollableElement(), null);
super.onDetach();
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
@Override
protected void onDetach() {
/*
* Detach the event listener in onDetach instead of onUnload so users cannot
* accidentally override it.
*/
Event.setEventListener(getScrollableElement(), null);
super.onDetach();
}
代码示例来源:origin: net.wetheinter/gwt-user
@Override
protected void onDetach() {
/*
* Detach the event listener in onDetach instead of onUnload so users cannot
* accidentally override it.
*/
Event.setEventListener(getScrollableElement(), null);
super.onDetach();
}
代码示例来源:origin: net.wetheinter/gwt-user
@Override
protected void onAttach() {
super.onAttach();
/*
* Attach the event listener in onAttach instead of onLoad so users cannot
* accidentally override it.
*/
Event.setEventListener(getScrollableElement(), this);
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
@Override
protected void onDetach() {
/*
* Detach the event listener in onDetach instead of onUnload so users cannot
* accidentally override it.
*/
Event.setEventListener(getScrollableElement(), null);
super.onDetach();
}
}
代码示例来源:origin: net.wetheinter/gwt-user
@Override
protected void onAttach() {
super.onAttach();
/*
* Attach the event listener in onAttach instead of onLoad so users cannot
* accidentally override it. If the scrollable element is the same as the
* root element, then we set the event listener twice (once in
* super.onAttach() and once here), which is fine.
*/
Event.setEventListener(getScrollableElement(), this);
}
代码示例来源:origin: net.wetheinter/gwt-user
@Override
protected void onDetach() {
/*
* Detach the event listener in onDetach instead of onUnload so users cannot
* accidentally override it.
*/
Event.setEventListener(getScrollableElement(), null);
super.onDetach();
}
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
@Override
protected void onAttach() {
super.onAttach();
/*
* Attach the event listener in onAttach instead of onLoad so users cannot
* accidentally override it.
*/
Event.setEventListener(getScrollableElement(), this);
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
@Override
protected void onAttach() {
super.onAttach();
/*
* Attach the event listener in onAttach instead of onLoad so users cannot
* accidentally override it. If the scrollable element is the same as the
* root element, then we set the event listener twice (once in
* super.onAttach() and once here), which is fine.
*/
Event.setEventListener(getScrollableElement(), this);
}
代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit
public CubaWindowWidget() {
DOM.sinkEvents(header, DOM.getEventsSunk(header) | Event.ONCONTEXTMENU);
addStyleName(NONMODAL_WINDOW_CLASSNAME);
Event.sinkEvents(getModalityCurtain(), Event.ONCLICK);
Event.setEventListener(getModalityCurtain(), event -> {
if (closeOnClickOutside) {
if (clickOnModalityCurtain != null) {
clickOnModalityCurtain.run();
}
}
});
}
代码示例来源:origin: org.eclipse.che.plugin/che-plugin-git-ext-git
private void setCheckBoxClickHandler(Path nodePath, Element checkBoxElement, boolean isChecked) {
Event.sinkEvents(checkBoxElement, Event.ONCLICK);
Event.setEventListener(
checkBoxElement,
event -> {
if (Event.ONCLICK == event.getTypeInt()
&& event.getTarget().getTagName().equalsIgnoreCase("label")) {
handleCheckBoxSelection(nodePath, isChecked);
delegate.refreshNodes();
}
});
}
代码示例来源:origin: OpenNMS/opennms
public ImageTracker(String imageUrl) {
m_image = new Image(imageUrl);
Event.setEventListener(m_image.getElement(), new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if(Event.ONLOAD == event.getTypeInt()) {
callHandlers();
m_loadComplete = true;
}
}
});
Element div = Document.get().getElementById(m_trackerDivId);
div.appendChild(m_image.getElement());
//Document.get().getBody().appendChild(m_image.getElement());
}
代码示例来源:origin: org.opennms.features.topology/org.opennms.features.topology.app
public ImageTracker(String imageUrl) {
m_image = new Image(imageUrl);
Event.setEventListener(m_image.getElement(), new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if(Event.ONLOAD == event.getTypeInt()) {
callHandlers();
m_loadComplete = true;
}
}
});
Element div = Document.get().getElementById(m_trackerDivId);
div.appendChild(m_image.getElement());
//Document.get().getBody().appendChild(m_image.getElement());
}
代码示例来源:origin: org.dashbuilder/dashbuilder-navigation-client
@Override
public void addCommand(String name, Command command) {
AnchorElement anchor = Document.get().createAnchorElement();
anchor.setInnerText(name);
LIElement li = Document.get().createLIElement();
li.getStyle().setCursor(Style.Cursor.POINTER);
li.appendChild(anchor);
commandMenu.appendChild((Node) li);
Event.sinkEvents(anchor, Event.ONCLICK);
Event.setEventListener(anchor, event -> {
if(Event.ONCLICK == event.getTypeInt()) {
command.execute();
}
});
}
代码示例来源:origin: org.dashbuilder/dashbuilder-navigation-client
@Override
public void addCommand(String name, Command command) {
AnchorElement anchor = Document.get().createAnchorElement();
anchor.setInnerText(name);
LIElement li = Document.get().createLIElement();
li.getStyle().setCursor(Style.Cursor.POINTER);
li.appendChild(anchor);
commandMenu.appendChild((Node) li);
Event.sinkEvents(anchor, Event.ONCLICK);
Event.setEventListener(anchor, event -> {
if(Event.ONCLICK == event.getTypeInt()) {
command.execute();
}
});
}
代码示例来源:origin: org.dashbuilder/dashbuilder-navigation-client
private void addItem(UnorderedList unorderedList, String name, boolean selected, Command onSelect) {
AnchorElement anchor = Document.get().createAnchorElement();
anchor.setInnerText(name);
LIElement li = Document.get().createLIElement();
li.getStyle().setCursor(Style.Cursor.POINTER);
li.appendChild(anchor);
li.setClassName(selected ? "selected" : "");
unorderedList.appendChild((Node) li);
Event.sinkEvents(anchor, Event.ONCLICK);
Event.setEventListener(anchor, event -> {
if(Event.ONCLICK == event.getTypeInt()) {
onSelect.execute();
}
});
}
代码示例来源:origin: dashbuilder/dashbuilder
private void addItem(UnorderedList unorderedList, String name, boolean selected, Command onSelect) {
AnchorElement anchor = Document.get().createAnchorElement();
anchor.setInnerText(name);
LIElement li = Document.get().createLIElement();
li.getStyle().setCursor(Style.Cursor.POINTER);
li.appendChild(anchor);
li.setClassName(selected ? "selected" : "");
unorderedList.appendChild((Node) li);
Event.sinkEvents(anchor, Event.ONCLICK);
Event.setEventListener(anchor, event -> {
if(Event.ONCLICK == event.getTypeInt()) {
onSelect.execute();
}
});
}
内容来源于网络,如有侵权,请联系作者删除!