本文整理汇总了Java中com.google.gwt.user.client.Event.setEventListener方法的典型用法代码示例。如果您正苦于以下问题:Java Event.setEventListener方法的具体用法?Java Event.setEventListener怎么用?Java Event.setEventListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.Event
的用法示例。
在下文中一共展示了Event.setEventListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addClickHandler
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
private void addClickHandler(Set<String> ids, final VizClickHandler handler) {
for (String nodeId : ids) {
Element svgNode = DOM.getElementById(nodeId);
Event.sinkEvents(svgNode, Event.ONCLICK);
Event.setEventListener(svgNode, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
handler.onClick(event);
}
});
}
}
示例2: CubaWindowWidget
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
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();
}
}
});
}
示例3: initPanels
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
private void initPanels() {
pagination = new Pagination();
pager = new SimplePager();
VerticalPanel bottomWidgets = new VerticalPanel();
startDateControlScrollbar = new NativeHorizontalScrollbar();
startDateControlScrollbar.setWidth("100%");
startDateControlScrollbar.addScrollHandler((e) -> {
double pos = (startDateControlScrollbar.getHorizontalScrollPosition()
+ 0.0) /
(startDateControlScrollbar.getScrollWidth());
long secondsBetween = presenter.getHardEndDateBound().toEpochSecond(ZoneOffset.UTC) - presenter
.getHardStartDateBound()
.toEpochSecond(ZoneOffset.UTC);
presenter.setToolBox(null);
presenter.getCalendar().setDate(presenter.getHardStartDateBound().plusSeconds(Math.round(secondsBetween
* pos)));
});
daysShownRangeSlider = RangeSlider.create();
daysShownRangeSlider.setMin("1");
daysShownRangeSlider.setMax("7");
daysShownRangeSlider.setStep("1");
daysShownRangeSlider.setAttribute("orient", "vertical");
CssResources.INSTANCE.calendar().ensureInjected();
daysShownRangeSlider.setClassName(CssResources.INSTANCE.calendar().verticalSlider());
daysShownRangeSlider.setValue(Integer.toString(presenter.getDaysShown()));
Event.setEventListener(daysShownRangeSlider, (e) -> {
presenter.getCalendar().setDaysShown(Integer
.parseInt(daysShownRangeSlider.getValue()));
});
//Work around for there not being a Event.ONINPUT
Event.sinkEvents(daysShownRangeSlider, ~0);
daysShownRangeSliderContainer = new Span();
daysShownRangeSliderContainer.getElement().appendChild(daysShownRangeSlider);
sidePanel.add(daysShownRangeSliderContainer);
bottomWidgets.add(startDateControlScrollbar);
bottomWidgets.add(pagination);
bottomPanel.add(bottomWidgets);
pager.setDisplay(presenter.getPager());
pager.setPageSize(presenter.getTotalDisplayedSpotSlots());
pagination.clear();
}