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]); }
/** * Tests getRowData, isContainer, enterContainer, exitContainer, getRowCount, setRowIndex, * getRowIndex, getContainerRowKey */ private void _testTree(TreeModel model, Bean bean) { assertEquals("rowData", bean, model.getRowData()); List<Bean> kids = bean.getKids(); boolean hasChildren = (kids != null); assertEquals("isContainer", hasChildren, model.isContainer()); if (hasChildren) { Object parentKey = model.getRowKey(); model.enterContainer(); assertEquals("getContainerRowKey", parentKey, model.getContainerRowKey()); _testTree(model, kids); model.exitContainer(); assertEquals("rowData after exit", bean, model.getRowData()); assertEquals("isContainer after exit", hasChildren, model.isContainer()); } }