本文整理匯總了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();
}