/** * @param index index of row to be selected * @param forceExpand whether the selected row shall be expanded * @return whether the index exists */ protected boolean setSelectedIndex(int index, boolean forceExpand) { try { RowWidget w = (RowWidget) flowPanel.getWidget(index); setSelectedKey(w.getKey(), forceExpand); return true; } catch (Exception e) { return false; } }
/** Does the actual addition of {@link UserItem}s to the top of the list. */ public void addTail() { List<UserItem> l = tail; if (l.size() > 0) { tail = new ArrayList<UserItem>(); tailKeys = new HashSet<Key>(); for (UserItem e : l) { RowWidget row = createRow(e); flowPanel.add(row); rows.put(row.getKey(), row); } rowsAdded(); NewDataEvent.fire(this, NewDataType.NEW_DATA_SHOWN); } }
/** 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); } }