• Returns: range-based (not absolute) index within the current range


    /**
       * This method is for use with UI Table addRows buttons that require the
       * addition of multiple rows; given a RowIterator (such as a VO) and the
       * number of rows the caller needs to add, this method figures out where
       * the caller should start adding rows in order to comply with the BLAF
       * standard that newly added rows should go into the bottom of the current
       * table range (which is the same as the RowIterator range if things are
       * set up properly), pushing rows into the next range if necessary
       *
       * Returns: range-based (not absolute) index within the current range
       */
      public static int getStartIndexForMultiInsert(RowIterator rowIt, int numRowsToAdd)
      {
        int numRowsInRange = rowIt.getRowCountInRange();
        int rangeSize = rowIt.getRangeSize();
        int firstIndexAtWhichToAdd = 0;
        int numOpenSlotsInRange = (rangeSize - numRowsInRange);
    
        if (rowIt.getRangeSize() < rangeSize)
        {
          rowIt.setRangeSize(rangeSize);
        }
    
        if (numOpenSlotsInRange < numRowsToAdd)
        {
          firstIndexAtWhichToAdd = rangeSize - numRowsToAdd;
        }
        else
        {
          firstIndexAtWhichToAdd = numRowsInRange;
        }
    
        return firstIndexAtWhichToAdd;
      }
    
    调用: 
     int indexForRowInserts = getStartIndexForMultiInsert(vo, 1);
      vo.insertRowAtRangeIndex(indexForRowInserts,row);
  • 相关阅读:
    英语俚语里的gotta和gonna
    如何设置Win XP远程登录如何远程控制电脑
    C#中as与is的用法(收藏)
    just用法
    even用法
    up to用法小结
    go out with用法
    realize与recognize辨析
    go through用法
    堆优先队列
  • 原文地址:https://www.cnblogs.com/huanghongbo/p/5274640.html
Copyright © 2020-2023  润新知