@UiHandler("tagScrollPanel") public void dragFollowingScrollPanel(ScrollEvent event) { if (tagScrollPanel.getVerticalScrollPosition() == tagScrollPanel.getMaximumVerticalScrollPosition() && totalResourceCount < totalHintCount) { String profileUserUserId = AppClientFactory.getPlaceManager().getRequestParameter("id", null); AppClientFactory.getInjector() .getUserService() .getResourcesByTag( tagId, Integer.toString(totalResourceCount), limit, profileUserUserId, new SimpleAsyncCallback<List<UserTagsResourceDO>>() { @Override public void onSuccess(List<UserTagsResourceDO> result) { if (result.size() > 0) { totalResourceCount = totalResourceCount + result.size(); for (int i = 0; i < result.size(); i++) { ProfileUserTagsResourceWidget profileUserTagsResourceWidget = new ProfileUserTagsResourceWidget(result.get(i)); userTagsResourceContainerConatiner.add(profileUserTagsResourceWidget); } } } }); } }
/** Does the actual addition of {@link UserItem}s to the top of the list. */ private void addHead() { List<UserItem> l = head; if (l.size() > 0) { head = new ArrayList<UserItem>(); headKeys = new HashSet<Key>(); int offsetHeight = flowPanel.getOffsetHeight(); for (int i = l.size() - 1; i >= 0; i--) { UserItem e = l.get(i); RowWidget row = createRow(e); flowPanel.insert(row, 0); rows.put(row.getKey(), row); } int deltaHeight = flowPanel.getOffsetHeight() - offsetHeight; scrollPanel.setVerticalScrollPosition(scrollPanel.getVerticalScrollPosition() + deltaHeight); rowsAdded(); NewDataEvent.fire(this, NewDataType.NEW_DATA_SHOWN); } }