コード例 #1
0
 private void _followPath(TreeModel model, int[] path) {
   model.setRowKey(null);
   int lastIndex = path.length - 1;
   for (int i = 0; i < lastIndex; i++) {
     model.setRowIndex(path[i]);
     model.enterContainer();
   }
   model.setRowIndex(path[lastIndex]);
 }
コード例 #2
0
  /**
   * Tests getRowData, isContainer, enterContainer, exitContainer, getRowCount, setRowIndex,
   * getRowIndex, getContainerRowKey
   */
  private void _testTree(TreeModel model, List<Bean> data) {
    int sz = data.size();
    assertEquals("rowCount", sz, model.getRowCount());
    assertEquals("initial rowIndex", -1, model.getRowIndex());

    if (sz > 0) {
      int oldIndex = model.getRowIndex();
      for (int i = 0; i < sz; i++) {
        Bean child = data.get(i);
        model.setRowIndex(i);
        assertEquals("rowIndex before enterContainer", i, model.getRowIndex());
        _testTree(model, child);
        assertEquals("rowIndex after exitContainer", i, model.getRowIndex());
      }
      model.setRowIndex(oldIndex);
    }
  }