private TestStepInstance getRoot(String name) { Object root = jXTreeTable.getTreeTableModel().getRoot(); if (!jXTreeTable.getTreeTableModel().isLeaf(root)) { for (int i = 0; i < jXTreeTable.getTreeTableModel().getChildCount(root); i++) { Object node = jXTreeTable.getTreeTableModel().getChild(root, i); if (TestStepInstance.class.isAssignableFrom(node.getClass())) { // System.out.println("checking:" + ((TestStepInstance) node).getTestStepInstancePath()); if (((TestStepInstance) node).getTestStepInstancePath().equals(name)) { // System.out.println("getRoot has found the root step:" + ((TestStepInstance) node).getTestStepInstancePath()); return (TestStepInstance) node; } } } } //System.out.println("getRoot did not found root with name: " + name); return null; }
@Override public void propertyChange(PropertyChangeEvent evt) { TreeTableModel model = (TreeTableModel) evt.getOldValue(); model.removeTreeModelListener(getTreeModelListener()); model = (TreeTableModel) evt.getNewValue(); model.addTreeModelListener(getTreeModelListener()); fireTableStructureChanged(); } });
@Override public Class<?> getColumnClass(int column) { return ((TreeTableModel) tree.getModel()).getColumnClass(column); }
/** * * @param node the node in the treeModel as passed into the TreeCellRenderer * @return the corresponding value of the hierarchical cell in the TreeTableModel */ private Object getHierarchicalTableValue(Object node) { Object val = node; if (treeTable != null) { int treeColumn = treeTable.getTreeTableModel().getHierarchicalColumn(); Object o = null; if (treeColumn >= 0) { // following is unreliable during a paint cycle // somehow interferes with BasicTreeUIs painting cache // o = treeTable.getValueAt(row, treeColumn); // ask the model - that's always okay // might blow if the TreeTableModel is strict in // checking the containment of the value and // this renderer is called for sizing with a prototype o = treeTable.getTreeTableModel().getValueAt(node, treeColumn); } val = o; } return val; }
if (!getTreeTableModel().isLeaf(node) && (getTreeTableModel().getChildCount(node) > 0 || !renderer .hasBeenExpanded(path))) { Rectangle cellBounds = getCellRect(row, col, false);
/** * Returns the index of the hierarchical column. This is the column that is * displayed as the tree. * * @return the index of the hierarchical column, -1 if there is * no hierarchical column * */ public int getHierarchicalColumn() { return convertColumnIndexToView(((TreeTableModel) renderer.getModel()).getHierarchicalColumn()); }
/** * {@inheritDoc} */ @Override public boolean isLeaf() { // Issue #270-swingx: guard against invisible row TreePath path = table.getPathForRow(row); if (path != null) { return table.getTreeTableModel().isLeaf(path.getLastPathComponent()); } // JW: this is the same as BasicTreeUI.isLeaf. // Shouldn't happen anyway because must be called for visible rows only. return true; } /**
public Object getValueAt(int row, int column) { // Issue #270-swingx: guard against invisible row Object node = nodeForRow(row); return node != null ? ((TreeTableModel) tree.getModel()).getValueAt(node, column) : null; }
@Override public boolean isCellEditable(int row, int column) { // Issue #270-swingx: guard against invisible row Object node = nodeForRow(row); return node != null ? ((TreeTableModel) tree.getModel()).isCellEditable(node, column) : false; }
@Override public String getColumnName(int column) { return ((TreeTableModel) tree.getModel()).getColumnName(column); }
public int getColumnCount() { return ((TreeTableModel) tree.getModel()).getColumnCount(); }
/** * * @param node the node in the treeModel as passed into the TreeCellRenderer * @return the corresponding value of the hierarchical cell in the TreeTableModel */ private Object getHierarchicalTableValue(Object node) { Object val = node; if (treeTable != null) { int treeColumn = treeTable.getTreeTableModel().getHierarchicalColumn(); Object o = null; if (treeColumn >= 0) { // following is unreliable during a paint cycle // somehow interferes with BasicTreeUIs painting cache // o = treeTable.getValueAt(row, treeColumn); // ask the model - that's always okay // might blow if the TreeTableModel is strict in // checking the containment of the value and // this renderer is called for sizing with a prototype o = treeTable.getTreeTableModel().getValueAt(node, treeColumn); } val = o; } return val; }
if (!getTreeTableModel().isLeaf(node) && (getTreeTableModel().getChildCount(node) > 0 || !renderer .hasBeenExpanded(path))) { Rectangle cellBounds = getCellRect(row, col, false);
/** * Returns the index of the hierarchical column. This is the column that is * displayed as the tree. * * @return the index of the hierarchical column, -1 if there is * no hierarchical column * */ public int getHierarchicalColumn() { return convertColumnIndexToView(((TreeTableModel) renderer.getModel()).getHierarchicalColumn()); }
/** * {@inheritDoc} */ @Override public boolean isLeaf() { // Issue #270-swingx: guard against invisible row TreePath path = table.getPathForRow(row); if (path != null) { return table.getTreeTableModel().isLeaf(path.getLastPathComponent()); } // JW: this is the same as BasicTreeUI.isLeaf. // Shouldn't happen anyway because must be called for visible rows only. return true; } /**
@Override public Object getValueAt(int row, int column) { // Issue #270-swingx: guard against invisible row Object node = nodeForRow(row); return node != null ? getTreeTableModel().getValueAt(node, column) : null; }
@Override public boolean isCellEditable(int row, int column) { // Issue #270-swingx: guard against invisible row Object node = nodeForRow(row); return node != null ? getTreeTableModel().isCellEditable(node, column) : false; }
@Override public String getColumnName(int column) { return getTreeTableModel().getColumnName(column); }
@Override public int getColumnCount() { return getTreeTableModel().getColumnCount(); }
@Override public void propertyChange(PropertyChangeEvent evt) { TreeTableModel model = (TreeTableModel) evt.getOldValue(); model.removeTreeModelListener(getTreeModelListener()); model = (TreeTableModel) evt.getNewValue(); model.addTreeModelListener(getTreeModelListener()); fireTableStructureChanged(); } });