use of com.google.gwt.event.dom.client.ScrollHandler in project rstudio by rstudio.
the class EnvironmentObjects method setDeferredObjectDisplay.
private void setDeferredObjectDisplay() {
if (deferredObjectDisplayType_ == null) {
return;
}
final int type = deferredObjectDisplayType_;
// if we already have an active display of this type, do nothing
if (type == objectDisplayType_ && objectDisplay_ != null) {
return;
}
// clean up previous object display, if we had one
if (objectDisplay_ != null) {
objectDataProvider_.removeDataDisplay(objectDisplay_);
splitPanel.remove(objectDisplay_);
}
try {
// create the new object display and wire it to the data source
if (type == OBJECT_LIST_VIEW) {
objectDisplay_ = new EnvironmentObjectList(this, observer_, environmentName_);
objectSort_.setSortType(RObjectEntrySort.SORT_AUTO);
} else if (type == OBJECT_GRID_VIEW) {
objectDisplay_ = new EnvironmentObjectGrid(this, observer_, environmentName_);
objectSort_.setSortType(RObjectEntrySort.SORT_COLUMN);
}
} catch (Throwable e) {
if (SuperDevMode.isActive()) {
if (gridRenderRetryCount_ >= 5) {
Debug.log("WARNING: Failed to render environment pane data grid");
}
gridRenderRetryCount_++;
Debug.log("WARNING: Retrying environment data grid render (" + gridRenderRetryCount_ + ")");
Timer t = new Timer() {
@Override
public void run() {
setObjectDisplay(type);
}
};
t.schedule(5);
}
return;
}
objectDisplayType_ = type;
Collections.sort(objectDataProvider_.getList(), objectSort_);
updateCategoryLeaders(false);
objectDataProvider_.addDataDisplay(objectDisplay_);
objectDisplay_.getScrollPanel().addScrollHandler(new ScrollHandler() {
@Override
public void onScroll(ScrollEvent event) {
if (useStatePersistence()) {
deferredScrollPosition_ = getScrollPosition();
observer_.setPersistedScrollPosition(deferredScrollPosition_);
}
}
});
objectDisplay_.setEmptyTableWidget(buildEmptyGridMessage());
objectDisplay_.addStyleName(style.objectGrid());
objectDisplay_.addStyleName(style.environmentPanel());
splitPanel.add(objectDisplay_);
deferredObjectDisplayType_ = null;
}
use of com.google.gwt.event.dom.client.ScrollHandler in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerViewImplTest method testRadarIsUpdatedAfterScrolling.
@Test
public void testRadarIsUpdatedAfterScrolling() throws Exception {
final ArgumentCaptor<ScrollHandler> scrollHandler = ArgumentCaptor.forClass(ScrollHandler.class);
final ScrollEvent scrollEvent = mock(ScrollEvent.class);
final AbsolutePanel mainPanel = mock(AbsolutePanel.class);
final Transform transform = mock(Transform.class);
final Viewport viewport = mock(Viewport.class);
final Mediators mediators = mock(Mediators.class);
final Element element = mock(Element.class);
doReturn(transform).when(transform).scale(anyDouble());
doReturn(presenter).when(view).getPresenter();
doReturn(transform).when(view).newTransform();
doReturn(mediators).when(viewport).getMediators();
doReturn(element).when(mockGridPanel).getElement();
doReturn(mainPanel).when(mockGridPanel).getScrollPanel();
doReturn(viewport).when(mockGridPanel).getViewport();
view.setupGridPanel();
verify(mainPanel).addDomHandler(scrollHandler.capture(), eq(ScrollEvent.getType()));
scrollHandler.getValue().onScroll(scrollEvent);
verify(presenter).updateRadar();
}
Aggregations