Example #1
0
  /**
   * Check bookmark at the specified row number.
   *
   * @param item row number.
   * @param checked true if checked.
   * @param activeVector vector of active bookmarks.
   */
  protected void setCheckedItem(final int item, final boolean checked, final Vector activeVector) {
    final Bookmark bookmark = getBookmark(item);

    if (bookmark.size() > 0) {
      final Enumeration e = bookmark.elements();
      int i = item + 1;

      if (e.hasMoreElements()) {
        if (checked) {
          do {
            final Bookmark child = (Bookmark) e.nextElement();
            final Bookmark next = getBookmark(i);

            if (next == child) {
              break;
            }

            activeVector.insertElementAt(child, i++);
          } while (e.hasMoreElements());
        } else {
          do {
            final Bookmark child = (Bookmark) e.nextElement();
            final Bookmark next = getBookmark(i);

            if (next != child) {
              break;
            }

            setCheckedItem(i, false);
            activeVector.removeElementAt(i);
          } while (e.hasMoreElements());
        }
      }

      repaint(20L);
    }
  }