public int getRowForPath(TreePath path) { return treeState.getRowForPath(path); }
private Rectangle getPathBounds(TreePath path, Insets insets, Rectangle bounds) { bounds = treeState.getBounds(path, bounds); if (bounds != null) { bounds.x = 0; bounds.y += insets.top; bounds.width = tree.getWidth(); } return bounds; } }
public TreePath getPathForRow(int row) { return treeState.getPathForRow(row); }
public void setRootVisible(boolean rootVisible) { if (isRootVisible() != rootVisible) { boolean oldVal = treeState.isRootVisible(); treeState.setRootVisible(rootVisible); fireViewportChanged(false); reload(); propertyChangeSupport.firePropertyChange("rootVisible", oldVal, treeState.isRootVisible()); } }
.getVisiblePathsFrom(initialPath); int row = treeState.getRowForPath(initialPath); int endY = paintBounds.y + paintBounds.height; .getLastPathComponent()); boolean isExpanded = isLeaf ? false : treeState .getExpandedState(path); Component renderer = this.currentCellRenderer .getTreeCellRendererComponent(this.tree, path if (background == null) background = tree.getBackground(); bounds = treeState.getBounds(path, boundsBuffer); bounds.x += insets.left; bounds.y += insets.top;
TreePath path = getLayoutCache().getPathForRow(convertRowIndexToModel(row)); if (!getOutlineModel().isLeaf(path.getLastPathComponent())) { int handleWidth = DefaultOutlineCellRenderer.getExpansionHandleWidth(); me.getClickCount() > 1) { boolean expanded = getLayoutCache().isExpanded(path); if (!expanded) { getTreePathSupport().expandPath(path); Object lastChild = getOutlineModel().getChild(ourObject, cCount - 1); TreePath lastChildPath = path.pathByAddingChild(lastChild); int lastRow = getLayoutCache().getRowForPath(lastChildPath); Rectangle rect = getCellRect(lastRow, 0, true); scrollRectToVisible(rect);
protected void configureTreeCellEditor( Component editor, int row, int column ) { if( !(editor instanceof JComponent) ) { return; } TreeCellEditorBorder b = new TreeCellEditorBorder(); TreePath path = getLayoutCache().getPathForRow(convertRowIndexToModel(row)); Object o = getValueAt(row, column); RenderDataProvider rdp = getRenderDataProvider(); b.icon = rdp.getIcon(o); b.nestingDepth = Math.max( 0, path.getPathCount() - (isRootVisible() ? 1 : 2) ); b.isLeaf = getOutlineModel().isLeaf(o); b.isExpanded = getLayoutCache().isExpanded(path); ((JComponent)editor).setBorder(b); }
Insets insets = tree.getInsets(); TreePath initialPath = getClosestPathForLocation(tree, 0, paintBounds.y); Enumeration paintingEnumerator = treeState.getVisiblePathsFrom(initialPath); int row = treeState.getRowForPath(initialPath); int endY = paintBounds.y + paintBounds.height; TreeModel treeModel = tree.getModel(); isExpanded = hasBeenExpanded = false; } else { isExpanded = treeState.getExpandedState(path); hasBeenExpanded = tree.hasBeenExpanded(path); paintingEnumerator = treeState.getVisiblePathsFrom(initialPath); while (!done && paintingEnumerator.hasMoreElements()) { path = (TreePath) paintingEnumerator.nextElement(); isExpanded = hasBeenExpanded = false; } else { isExpanded = treeState.getExpandedState(path); hasBeenExpanded = tree.hasBeenExpanded(path);
int row = getLayout().getRowForPath(path); boolean realInsert = getLayout().isExpanded(path);
return 0; TreePath tp1 = getLayoutCache().getPathForRow(index1); TreePath tp2 = getLayoutCache().getPathForRow(index2); if (tp1.isDescendant(tp2)) { return -1; parent2 = tp2.getParentPath(); int r1 = getLayoutCache().getRowForPath(tp1); int r2 = getLayoutCache().getRowForPath(tp2);
/** * Expand this tree row. * If tree is inside a {@link SScrollPane} try to * adjust pane, so that as much as possible new * nodes are visible. * @param p the TreePath to expand */ public void expandPath(TreePath p) { treeState.setExpandedState(p, true); if (viewport != null) { Rectangle area = new Rectangle(viewport); area.y = treeState.getRowForPath(p); area.height = model.getChildCount(p.getLastPathComponent()) + 1; scrollRectToVisible(area); } fireTreeExpanded(p); reload(); }
TreePath initialPath = getClosestPathForLocation(tree, 0, paintBounds.y); Enumeration<?> paintingEnumerator = treeState .getVisiblePathsFrom(initialPath); int endY = paintBounds.y + paintBounds.height; path = (TreePath) paintingEnumerator.nextElement(); if (path != null) { bounds = treeState.getBounds(path, boundsBuffer); bounds.x += insets.left; bounds.y += insets.top;
int row = getLayout().getRowForPath(path); if (row == -1) { getLayout().getVisibleChildCount(childPath);
public boolean isExpanded(TreePath path) { return treeState.isExpanded(path); }
public boolean isRootVisible() { return treeState.isRootVisible(); }
public void recalculateSizing() { if (treeState != null) { treeState.invalidateSizes(); } updateSize(); }
public int getRowCount() { return treeState.getRowCount(); }
.getVisiblePathsFrom(initialPath); int row = treeState.getRowForPath(initialPath); int endY = paintBounds.y + paintBounds.height; .getLastPathComponent()); boolean isExpanded = isLeaf ? false : treeState .getExpandedState(path); Component renderer = this.currentCellRenderer .getTreeCellRendererComponent(this.tree, path if (background == null) background = tree.getBackground(); bounds = treeState.getBounds(path, boundsBuffer); if(bounds != null){ bounds.x += insets.left;
TreePath tp = view.getOutline().getLayoutCache().getPathForRow( view.getOutline().convertRowIndexToModel(row)); if (LOGABLE) { log("tp == " + tp); //NOI18N if (!view.getOutline().getLayoutCache().isExpanded(tp)) { log("tree path is not expanded"); // NOI18N TreePath path = view.getOutline().getLayoutCache().getPathForRow( view.getOutline().convertRowIndexToModel(row)); if( null != path ) { TreePath parentPath = path.getParentPath(); if( null != parentPath ) { int parentRow = view.getOutline().getLayoutCache().getRowForPath(parentPath); dropIndex = row-parentRow; final TreePath path = view.getOutline().getLayoutCache().getPathForRow( view.getOutline().convertRowIndexToModel(row)); boolean expanded = view.getOutline().getLayoutCache().isExpanded(path); if ( ((timer == null) || !timer.isRunning()) && (dropNode != null) && !dropNode.isLeaf()
public void actionPerformed(ActionEvent e) { if( getSelectedRowCount() == 1 && isTreeColumnIndex (getSelectedColumn()) ) { int selRow = getSelectedRow(); TreePath selPath = getLayoutCache().getPathForRow(selRow); if( null != selPath && !getOutlineModel().isLeaf(selPath.getLastPathComponent()) ) { boolean expanded = getLayoutCache().isExpanded(selPath); if( expanded && !expand ) { collapsePath(selPath); return; } else if( !expanded && expand ) { expandPath(selPath); return; } } } if( null != origAction ) origAction.actionPerformed(e); } }