📄 jxtreetable.java
字号:
/** * Overridden to ensure that private renderer state is kept in sync with the * state of the component. Calls the inherited version after performing the * necessary synchronization. If you override this method, make sure you call * this version from your version of this method. */ public void clearSelection() { if (renderer != null) { renderer.clearSelection(); } super.clearSelection(); } /** * Collapses all nodes in the treetable. */ public void collapseAll() { renderer.collapseAll(); } /** * Expands all nodes in the treetable. */ public void expandAll() { renderer.expandAll(); } /** * Collapses the node at the specified path in the treetable. * * @param path path of the node to collapse */ public void collapsePath(TreePath path) { renderer.collapsePath(path); } /** * Expands the the node at the specified path in the treetable. * * @param path path of the node to expand */ public void expandPath(TreePath path) { renderer.expandPath(path); } /** * Collapses the row in the treetable. If the specified row index is * not valid, this method will have no effect. */ public void collapseRow(int row) { renderer.collapseRow(row); } /** * Expands the specified row in the treetable. If the specified row index is * not valid, this method will have no effect. */ public void expandRow(int row) { renderer.expandRow(row); } /** * Determines whether or not the root node from the TreeModel is visible. * * @param visible true, if the root node is visible; false, otherwise */ public void setRootVisible(boolean visible) { renderer.setRootVisible(visible); repaint(); } /** * Returns true if the root node of the tree is displayed. * * @return true if the root node of the tree is displayed */ public boolean isRootVisible() { return renderer.isRootVisible(); } /** * Returns true if the value identified by path is currently viewable, which * means it is either the root or all of its parents are expanded. Otherwise, * this method returns false. * * @return true, if the value identified by path is currently viewable; * false, otherwise */ public boolean isVisible(TreePath path) { return renderer.isVisible(path); } /** * Returns true if the node identified by path is currently expanded. * Otherwise, this method returns false. * * @param path path * @return true, if the value identified by path is currently expanded; * false, otherwise */ public boolean isExpanded(TreePath path) { return renderer.isExpanded(path); } /** * Returns true if the node at the specified display row is currently expanded. * Otherwise, this method returns false. * * @param row row * @return true, if the node at the specified display row is currently expanded. * false, otherwise */ public boolean isExpanded(int row) { return renderer.isExpanded(row); } /** * Returns true if the node identified by path is currently collapsed, * this will return false if any of the values in path are currently not * being displayed. * * @param path path * @return true, if the value identified by path is currently collapsed; * false, otherwise */ public boolean isCollapsed(TreePath path) { return renderer.isCollapsed(path); } /** * Returns true if the node at the specified display row is collapsed. * * @param row row * @return true, if the node at the specified display row is currently collapsed. * false, otherwise */ public boolean isCollapsed(int row) { return renderer.isCollapsed(row); } /** * Returns an <code>Enumeration</code> of the descendants of the * path <code>parent</code> that * are currently expanded. If <code>parent</code> is not currently * expanded, this will return <code>null</code>. * If you expand/collapse nodes while * iterating over the returned <code>Enumeration</code> * this may not return all * the expanded paths, or may return paths that are no longer expanded. * * @param parent the path which is to be examined * @return an <code>Enumeration</code> of the descendents of * <code>parent</code>, or <code>null</code> if * <code>parent</code> is not currently expanded */ public Enumeration getExpandedDescendants(TreePath parent) { return renderer.getExpandedDescendants(parent); } /** * Sets the value of the <code>expandsSelectedPaths</code> property for the tree * part. This property specifies whether the selected paths should be expanded. * * @param expand true, if selected paths should be expanded; false, otherwise */ public void setExpandsSelectedPaths(boolean expand) { renderer.setExpandsSelectedPaths(expand); } /** * Returns the value of the <code>expandsSelectedPaths</code> property. * * @return the value of the <code>expandsSelectedPaths</code> property */ public boolean getExpandsSelectedPaths() { return renderer.getExpandsSelectedPaths(); } /** * Returns the TreePath for a given x,y location. * * @param x x value * @param y y value * * @return the <code>TreePath</code> for the givern location. */ public TreePath getPathForLocation(int x, int y) { int row = rowAtPoint(new Point(x,y)); if (row == -1) { return null; } return renderer.getPathForRow(row); } /** * Returns the TreePath for a given row. * * @param row * * @return the <code>TreePath</code> for the given row. */ public TreePath getPathForRow(int row) { return renderer.getPathForRow(row); } /** * Returns the row for a given TreePath. * * @param path * @return the row for the given <code>TreePath</code>. */ public int getRowForPath(TreePath path) { return renderer.getRowForPath(path); } /** * Sets the value of the <code>scrollsOnExpand</code> property for the tree * part. This property specifies whether the expanded paths should be scrolled * into view. In a look and feel in which a tree might not need to scroll * when expanded, this property may be ignored. * * @param scroll true, if expanded paths should be scrolled into view; * false, otherwise */ public void setScrollsOnExpand(boolean scroll) { renderer.setScrollsOnExpand(scroll); } /** * Returns the value of the <code>scrollsOnExpand</code> property. * * @return the value of the <code>scrollsOnExpand</code> property */ public boolean getScrollsOnExpand() { return renderer.getScrollsOnExpand(); } /** * Sets the value of the <code>showsRootHandles</code> property for the tree * part. This property specifies whether the node handles should be displayed. * If handles are not supported by a particular look and feel, this property * may be ignored. * * @param visible true, if root handles should be shown; false, otherwise */ public void setShowsRootHandles(boolean visible) { renderer.setShowsRootHandles(visible); repaint(); } /** * Returns the value of the <code>showsRootHandles</code> property. * * @return the value of the <code>showsRootHandles</code> property */ public boolean getShowsRootHandles() { return renderer.getShowsRootHandles(); } /** * Adds a listener for <code>TreeExpansion</code> events. * * TODO (JW): redirect event source to this. * * @param tel a TreeExpansionListener that will be notified * when a tree node is expanded or collapsed */ public void addTreeExpansionListener(TreeExpansionListener tel) { renderer.addTreeExpansionListener(tel); } /** * Removes a listener for <code>TreeExpansion</code> events. * @param tel the <code>TreeExpansionListener</code> to remove */ public void removeTreeExpansionListener(TreeExpansionListener tel) { renderer.removeTreeExpansionListener(tel); } /** * Adds a listener for <code>TreeSelection</code> events. * TODO (JW): redirect event source to this. * * @param tsl a TreeSelectionListener that will be notified * when a tree node is selected or deselected */ public void addTreeSelectionListener(TreeSelectionListener tsl) { renderer.addTreeSelectionListener(tsl); } /** * Removes a listener for <code>TreeSelection</code> events. * @param tsl the <code>TreeSelectionListener</code> to remove */ public void removeTreeSelectionListener(TreeSelectionListener tsl) { renderer.removeTreeSelectionListener(tsl); } /** * Adds a listener for <code>TreeWillExpand</code> events. * TODO (JW): redirect event source to this. * * @param tel a TreeWillExpandListener that will be notified * when a tree node will be expanded or collapsed */ public void addTreeWillExpandListener(TreeWillExpandListener tel) { renderer.addTreeWillExpandListener(tel); } /** * Removes a listener for <code>TreeWillExpand</code> events. * @param tel the <code>TreeWillExpandListener</code> to remove */ public void removeTreeWillExpandListener(TreeWillExpandListener tel) { renderer.removeTreeWillExpandListener(tel); } /** * Returns the selection model for the tree portion of the this treetable. * * @return selection model for the tree portion of the this treetable */ public TreeSelectionModel getTreeSelectionModel() { return renderer.getSelectionModel(); // RG: Fix JDNC issue 41 } /** * Overriden to invoke supers implementation, and then, * if the receiver is editing a Tree column, the editors bounds is * reset. The reason we have to do this is because JTable doesn't
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -