예제 #1
0
  private synchronized boolean getJumpToPage() {
    try {
      // Get the actual entries
      if (!getEntries()) return false;

      // Check if we have a control returned
      LDAPControl[] c = mConn.getResponseControls();
      LDAPVirtualListResponse nextCont = null;

      if (c != null) {
        for (LDAPControl control : c) {
          if (control instanceof LDAPVirtualListResponse) {
            nextCont = (LDAPVirtualListResponse) control;
            break;
          }
        }
      }

      if (nextCont != null) {
        mSelectedIndex = nextCont.getFirstPosition() - 1;
        mTop = Math.max(0, mSelectedIndex - mBeforeCount);

        CMS.debug("DBVirtualList: top: " + mTop);
        if (mJumpTo != null) {
          mJumpToInitialIndex = mTop;
        }

        // Now we know the total size of the virtual list box
        mSize = nextCont.getContentCount();
        ((LDAPVirtualListControl) mPageControls[1]).setListSize(mSize);
        mInitialized = true;
        // System.out.println( "Virtual window: " + mTop +
        //       ".." + (mTop+mEntries.size()-1) +
        //      " of " + mSize );
      } else {
        mLogger.log(
            ILogger.EV_SYSTEM,
            ILogger.S_DB,
            ILogger.LL_FAILURE,
            CMS.getLogMessage("CMSCORE_DBS_VL_NULL_RESPONSE"));
      }
      return true;
    } catch (Exception e) {
      // happens when connection is not available
      return false;
    }
  }
예제 #2
0
  /** Fetch a buffer */
  private boolean getPage() {
    // Get the actual entries
    if (!getEntries()) return false;

    // Check if we have a control returned
    LDAPControl[] c = mConn.getResponseControls();
    LDAPVirtualListResponse nextCont = null;

    if (c != null) {
      for (LDAPControl control : c) {
        if (control instanceof LDAPVirtualListResponse) {
          nextCont = (LDAPVirtualListResponse) control;
          break;
        }
      }
    }

    if (nextCont != null) {
      mSelectedIndex = nextCont.getFirstPosition() - 1;
      mTop = Math.max(0, mSelectedIndex - mBeforeCount);
      // CMS.debug("New mTop: " + mTop + " mSelectedIndex " + mSelectedIndex);
      // Now we know the total size of the virtual list box
      mSize = nextCont.getContentCount();
      ((LDAPVirtualListControl) mPageControls[1]).setListSize(mSize);
      mInitialized = true;
      // System.out.println( "Virtual window: " + mTop +
      //       ".." + (mTop+mEntries.size()-1) +
      //      " of " + mSize );
    } else {

      /*LogDoc
       *
       * @phase local ldap search
       */
      mLogger.log(
          ILogger.EV_SYSTEM,
          ILogger.S_DB,
          ILogger.LL_FAILURE,
          CMS.getLogMessage("CMSCORE_DBS_VL_NULL_RESPONSE"));
    }
    return true;
  }