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();
}