@Override
 public void expandRow(final String rowPosition) {
   ViewNavigator nav = getNewNavigator();
   nav.gotoPos(rowPosition, '.');
   ViewEntry current = nav.getCurrent();
   int noteId = new BigInteger(current.getNoteID(), 16).intValue();
   collapsedIds_.remove(noteId);
   expandedIds_.add(noteId);
   clearCache();
 }
  @Override
  public int size() {
    if (size_ != -1) {
      return size_;
    }
    if (invalid_) {
      return 0;
    }

    try {
      if (searchQuery_ == null || searchQuery_.isEmpty()) {
        ViewNavigator nav = getNavigator();
        size_ = nav == null ? 0 : nav.getCount();
      } else {
        ViewEntryCollection vec = getEntries();
        size_ = vec == null ? 0 : vec.getCount();
      }
    } catch (Exception e) {
      throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
    }
    return size_;
  }
  protected ViewNavigator getNewNavigator() {
    View view = getView();
    ViewNavigator nav = null;
    if (category_ == null) {
      nav = view.createViewNav();
    } else {
      nav = view.createViewNavFromCategory(category_);
    }
    nav.setBufferMaxEntries(50); // The most common use will likely be a paged view

    int[] expandedIds = new int[expandedIds_.size()];
    int i = 0;
    for (Integer id : expandedIds_) {
      expandedIds[i++] = id;
    }
    int[] collapsedIds = new int[collapsedIds_.size()];
    i = 0;
    for (Integer id : collapsedIds_) {
      collapsedIds[i++] = id;
    }
    nav.setAutoExpandGuidance(50, collapsedIds, expandedIds);

    return nav;
  }
  /* **********************************************************************
   * List methods
   ************************************************************************/
  @Override
  @SuppressWarnings("deprecation")
  public E get(final int index) {
    if (invalid_) {
      return null;
    }

    Map<Integer, E> cache = getCache();
    if (!cache.containsKey(index)) {
      try {
        if (searchQuery_ == null || searchQuery_.isEmpty()) {
          ViewNavigator nav = getNavigator();

          // getNth is top-level only, so let's skip to what we need
          int lastFetchedIndex = 0;
          Map<String, Object> requestScope = getRequestScope();
          String key = "lastFetchedIndex-" + toString();
          if (requestScope.containsKey(key)) {
            lastFetchedIndex = (Integer) requestScope.get(key);
          }
          nav.skip(index - lastFetchedIndex);

          requestScope.put(key, index);

          try {
            // Try to get the current one, which may be null due to an as-yet-unsolved
            // "object has been removed or recycled" error. Check for that and switch to
            // our exception handler to retry
            ViewEntry entry = nav.getCurrent();
            if (entry == null) {
              throw new NullPointerException();
            }
            cache.put(index, createFromViewEntry(entry, columnInfo_));
          } catch (NullPointerException npe) {
            // Then we've probably hit an "Object has been removed or recycled" on the nav

            if (reset_ < 10) {
              reset_++;
              clearCache();
              return get(index);
            }

            System.out.println("=============================== NPE in DominoModelList");
            System.out.println(
                "=============================== Current class: " + getClass().getName());
            System.out.println("=============================== Type: " + getClazz().getName());
            System.out.println("=============================== Desired index: " + index);
            System.out.println("=============================== Current cache: " + cache);
            System.out.println("=============================== Current reported size: " + size());
            throw npe;
          } catch (RuntimeException re) {
            if (String.valueOf(re.getCause()).contains("Argument has been removed or recycled")) {
              if (reset_ < 10) {
                reset_++;
                clearCache();
                return get(index);
              }
            }
            // Otherwise, throw it up
            throw re;
          }
        } else {
          ViewEntryCollection vec = getEntries();
          cache.put(index, createFromViewEntry(vec.getNthEntry(index + 1), columnInfo_));
        }
      } catch (Exception e) {
        throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
      }
    }
    return cache.get(index);
  }