java.lang.Object
javax.swing.tree.AbstractLayoutCache
javax.swing.tree.VariableHeightLayoutCache
- 所有已实现的接口:
-
RowMapper
注意: 在将来的版本中将变得更加开放。
警告: 该类的序列化对象将不兼容未来的Swing版本。当前的序列化支持适用于短期存储或在运行相同Swing版本的应用程序之间的RMI。从1.4版本开始,已将所有JavaBeans的长期存储支持添加到java.beans包中。请参阅XMLEncoder。
-
Nested Class Summary
Nested classes/interfaces declared in class javax.swing.tree.AbstractLayoutCache
AbstractLayoutCache.NodeDimensions -
Field Summary
Fields declared in class javax.swing.tree.AbstractLayoutCache
nodeDimensions, rootVisible, rowHeight, treeModel, treeSelectionModel -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription返回包围标签部分的Rectangle,其中将绘制由path标识的项目。booleangetExpandedState(TreePath path) 如果路径已展开且可见,则返回true。getPathClosestTo(int x, int y) 返回最接近x、y的节点路径。getPathForRow(int row) 返回row的路径。int返回首选高度。intgetPreferredWidth(Rectangle bounds) 返回visibleRegion区域的首选宽度和高度。int返回可见行数。intgetRowForPath(TreePath path) 返回路径中最后一个项目可见的行。intgetVisibleChildCount(TreePath path) 返回path的可见子节点数。getVisiblePathsFrom(TreePath path) 返回一个Enumerator,从传入位置开始递增遍历可见路径。voidinvalidatePathBounds(TreePath path) 通知LayoutCache,path的边界无效,需要更新。void通知TreeState需要重新计算其引用的所有大小。booleanisExpanded(TreePath path) 如果由path标识的值当前已展开,则返回true。voidsetExpandedState(TreePath path, boolean isExpanded) 将路径path的展开状态标记为isExpanded。void设置将提供数据的TreeModel。void设置负责绘制树中节点的渲染器。voidsetRootVisible(boolean rootVisible) 确定TreeModel的根节点是否可见。voidsetRowHeight(int rowHeight) 设置每个单元格的高度。void在节点(或一组兄弟节点)以某种方式更改后调用。void在节点插入到树中后调用。void在节点从树中移除后调用。void在树从给定节点向下发生结构上的重大更改后调用。Methods declared in class javax.swing.tree.AbstractLayoutCache
getModel, getNodeDimensions, getNodeDimensions, getRowHeight, getRowsForPaths, getSelectionModel, isFixedRowHeight, isRootVisible, setSelectionModel
-
Constructor Details
-
VariableHeightLayoutCache
public VariableHeightLayoutCache()构造一个VariableHeightLayoutCache。
-
-
Method Details
-
setModel
@BeanProperty(description="The TreeModel that will provide the data.") public void setModel(TreeModel newModel) 设置将提供数据的TreeModel。- 覆盖:
-
setModel在类AbstractLayoutCache中 - 参数:
-
newModel- 将提供数据的TreeModel
-
setRootVisible
@BeanProperty(description="Whether or not the root node from the TreeModel is visible.") public void setRootVisible(boolean rootVisible) 确定TreeModel的根节点是否可见。- 覆盖:
-
setRootVisible在类AbstractLayoutCache中 - 参数:
-
rootVisible- 如果要显示树的根节点,则为true - 参见:
-
setRowHeight
设置每个单元格的高度。如果指定的值小于等于零,则查询当前单元格渲染器每行的高度。- 覆盖:
-
setRowHeight在类AbstractLayoutCache中 - 参数:
-
rowHeight- 每个单元格的高度,以像素为单位
-
setNodeDimensions
设置负责绘制树中节点的渲染器。- 覆盖:
-
setNodeDimensions在类AbstractLayoutCache中 - 参数:
-
nd- 渲染器
-
setExpandedState
将路径path的展开状态标记为isExpanded。- 指定者:
-
setExpandedState在类AbstractLayoutCache中 - 参数:
-
path- 感兴趣的TreePath -
isExpanded- 如果应展开路径,则为true,否则为false
-
getExpandedState
如果路径已展开且可见,则返回true。- 指定者:
-
getExpandedState在类AbstractLayoutCache中 - 参数:
-
path- 正在查询的路径 - 返回:
- 如果路径已展开且可见,则为true,否则为false
-
getBounds
返回包围标签部分的Rectangle,其中将绘制由path标识的项目。- 指定者:
-
getBounds在类AbstractLayoutCache中 - 参数:
-
path- 要绘制的路径 -
placeIn- 包围矩形的边界 - 返回:
-
包围矩形的边界,如果无法确定节点,则返回
null
-
getPathForRow
返回row的路径。如果row不可见,则返回null。- 指定者:
-
getPathForRow在类AbstractLayoutCache中 - 参数:
-
row- 感兴趣的位置 - 返回:
-
row的路径,如果row不可见,则返回null
-
getRowForPath
返回路径中最后一个项目可见的行。如果路径中的任何元素当前不可见,则返回-1。- 指定者:
-
getRowForPath在类AbstractLayoutCache中 - 参数:
-
path- 感兴趣的TreePath - 返回:
- 最后一个路径中的项目可见的行
-
getRowCount
public int getRowCount()返回可见行数。- 指定者:
-
getRowCount在类AbstractLayoutCache中 - 返回:
- 可见行数
-
invalidatePathBounds
通知LayoutCache,path的边界无效,需要更新。- 指定者:
-
invalidatePathBounds在类AbstractLayoutCache中 - 参数:
-
path- 现在无效的TreePath
-
getPreferredHeight
public int getPreferredHeight()返回首选高度。- 覆盖:
-
getPreferredHeight在类AbstractLayoutCache中 - 返回:
- 首选高度
-
getPreferredWidth
返回visibleRegion区域的首选宽度和高度。- 覆盖:
-
getPreferredWidth在类AbstractLayoutCache中 - 参数:
-
bounds- 正在查询的区域 - 返回:
- 传入区域的首选宽度
-
getPathClosestTo
返回最接近x、y的节点路径。如果当前没有任何内容可见,则返回null,否则将始终返回有效路径。如果需要测试返回的对象是否确切地位于x、y,则应获取返回路径的边界并将x、y与其进行比较。- 指定者:
-
getPathClosestTo在类AbstractLayoutCache中 - 参数:
-
x- x坐标 -
y- y坐标 - 返回:
- 最接近x、y的节点路径
-
getVisiblePathsFrom
返回一个Enumerator,从传入位置开始递增遍历可见路径。枚举的排序基于路径的显示方式。- 指定者:
-
getVisiblePathsFrom在类AbstractLayoutCache中 - 参数:
-
path- 起始TreePath中的位置 - 返回值:
-
逐渐遍历可见路径的
Enumerator
-
getVisibleChildCount
返回path的可见子节点数。- 指定者:
-
getVisibleChildCount在类AbstractLayoutCache中 - 参数:
-
path- 正在查询的路径 - 返回值:
-
path的可见子节点数
-
invalidateSizes
public void invalidateSizes()通知TreeState需要重新计算其引用的所有大小。- 指定者:
-
invalidateSizes在类AbstractLayoutCache中
-
isExpanded
如果由path标识的值当前已展开,则返回true。- 指定者:
-
isExpanded在类AbstractLayoutCache中 - 参数:
-
path- 要检查的TreePath - 返回值:
-
如果由
path标识的值当前已展开,则返回true
-
treeNodesChanged
在节点(或一组兄弟节点)以某种方式更改后调用。节点未在树中更改位置或更改其子节点数组,但其他属性已更改并可能影响显示。例如:文件的名称已更改,但它仍在文件系统中的相同位置。e.path返回更改的节点的父节点的路径。e.childIndices返回更改的节点的索引。- 指定者:
-
treeNodesChanged在类AbstractLayoutCache中 - 参数:
-
e- 感兴趣的TreeModelEvent
-
treeNodesInserted
在节点插入到树中后调用。e.path返回新节点的父节点。e.childIndices按升序返回新节点的索引。- 指定者:
-
treeNodesInserted在类AbstractLayoutCache中 - 参数:
-
e- 感兴趣的TreeModelEvent
-
treeNodesRemoved
在节点从树中移除后调用。请注意,如果从树中移除子树,则此方法可能仅对已移除子树的根节点调用一次,而不是对每个单独移除的兄弟节点集合调用一次。e.path返回已删除节点的原始父节点。e.childIndices按升序返回节点在删除之前的索引。- 指定者:
-
treeNodesRemoved在类AbstractLayoutCache中 - 参数:
-
e- 感兴趣的TreeModelEvent
-
treeStructureChanged
在树从给定节点开始结构发生重大更改后调用。如果e.getPath返回的路径长度为1,并且第一个元素不标识当前根节点,则第一个元素应成为树的新根。e.path保存到节点的路径。e.childIndices返回null。- 指定者:
-
treeStructureChanged在类AbstractLayoutCache中 - 参数:
-
e- 感兴趣的TreeModelEvent
-