java.lang.Object
javax.swing.tree.AbstractLayoutCache
javax.swing.tree.FixedHeightLayoutCache
- 所有已实现的接口:
-
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返回一个矩形,给出绘制路径所需的边界。booleangetExpandedState(TreePath path) 如果路径已展开且可见,则返回true。getPathClosestTo(int x, int y) 返回最接近x、y的节点路径。getPathForRow(int row) 返回传入行的路径。int返回可见行数。intgetRowForPath(TreePath path) 返回路径中最后一个标识项可见的行。intgetVisibleChildCount(TreePath path) 返回行的可见子项数。getVisiblePathsFrom(TreePath path) 返回一个Enumerator,从传入位置开始递增遍历可见路径。voidinvalidatePathBounds(TreePath path) 什么也不做,FixedHeightLayoutCache不缓存宽度,这是唯一可能发生变化的地方。void通知TreeState需要重新计算其引用的所有大小。booleanisExpanded(TreePath path) 如果由行标识的值当前已展开,则返回true。voidsetExpandedState(TreePath path, boolean isExpanded) 将路径path的展开状态标记为isExpanded。void设置将提供数据的TreeModel。voidsetRootVisible(boolean rootVisible) 确定TreeModel的根节点是否可见。voidsetRowHeight(int rowHeight) 设置每个单元格的高度。void在节点(或一组兄弟节点)以某种方式更改后调用。void在节点插入到树中后调用。void在节点从树中移除后调用。void在树从给定节点开始发生结构上的重大更改后调用。Methods declared in class javax.swing.tree.AbstractLayoutCache
getModel, getNodeDimensions, getNodeDimensions, getPreferredHeight, getPreferredWidth, getRowHeight, getRowsForPaths, getSelectionModel, isFixedRowHeight, isRootVisible, setNodeDimensions, setSelectionModel
-
Constructor Details
-
FixedHeightLayoutCache
public FixedHeightLayoutCache()构造一个FixedHeightLayoutCache。
-
-
Method Details
-
setModel
设置将提供数据的TreeModel。- 覆盖:
-
setModel在类中AbstractLayoutCache - 参数:
-
newModel- 将提供数据的TreeModel
-
setRootVisible
public void setRootVisible(boolean rootVisible) 确定TreeModel的根节点是否可见。- 覆盖:
-
setRootVisible在类中AbstractLayoutCache - 参数:
-
rootVisible- 如果要显示树的根节点,则为true - 参见:
-
setRowHeight
public void setRowHeight(int rowHeight) 设置每个单元格的高度。如果rowHeight小于等于0,则会抛出IllegalArgumentException。- 覆盖:
-
setRowHeight在类中AbstractLayoutCache - 参数:
-
rowHeight- 每个单元格的高度,以像素为单位
-
getRowCount
public int getRowCount()返回可见行数。- 指定由:
-
getRowCount在类中AbstractLayoutCache - 返回:
- 正在显示的行数
-
invalidatePathBounds
什么也不做,FixedHeightLayoutCache不缓存宽度,这是唯一可能发生变化的地方。- 指定由:
-
invalidatePathBounds在类中AbstractLayoutCache - 参数:
-
path- 正在更新的路径
-
invalidateSizes
public void invalidateSizes()通知TreeState需要重新计算其引用的所有大小。- 指定由:
-
invalidateSizes在类中AbstractLayoutCache
-
isExpanded
如果由行标识的值当前已展开,则返回true。- 指定由:
-
isExpanded在类中AbstractLayoutCache - 参数:
-
path- 要检查的TreePath - 返回:
- TreePath是否已展开
-
getBounds
返回一个矩形,给出绘制路径所需的边界。- 指定由:
-
getBounds在类中AbstractLayoutCache - 参数:
-
path- 指定节点的TreePath -
placeIn- 给定可用空间的Rectangle对象 - 返回:
- 指定要使用的空间的Rectangle对象
-
getPathForRow
返回传入行的路径。如果行不可见,则返回null。- 指定由:
-
getPathForRow在类中AbstractLayoutCache - 参数:
-
row- 正在查询的行 - 返回:
-
给定行的
TreePath
-
getRowForPath
返回路径中最后一个标识项可见的行。如果路径中的任何元素当前不可见,则返回-1。- 指定由:
-
getRowForPath在类中AbstractLayoutCache - 参数:
-
path- 正在查询的TreePath - 返回:
- 最后一个路径中的元素可见的行,如果路径中的任何元素当前不可见,则返回-1
-
getPathClosestTo
返回最接近x、y的节点路径。如果当前没有任何内容可见,则返回null,否则它将始终返回有效路径。如果需要测试返回的对象是否确切地位于x、y,则应获取返回路径的边界并将x、y与其进行测试。- 指定由:
-
getPathClosestTo在类中AbstractLayoutCache - 参数:
-
x- 所需位置的水平分量 -
y- 所需位置的垂直分量 - 返回:
-
最接近指定点的
TreePath
-
getVisibleChildCount
返回行的可见子项数。- 指定由:
-
getVisibleChildCount在类中AbstractLayoutCache - 参数:
-
path- 正在查询的路径 - 返回:
- 指定路径的可见子项数
-
getVisiblePathsFrom
返回一个Enumerator,从传入位置开始递增遍历可见路径。枚举的排序基于路径的显示方式。- 指定由:
-
getVisiblePathsFrom在类中AbstractLayoutCache - 参数:
-
path- 开始枚举的位置 - 返回:
-
从所需位置开始的
Enumerator
-
setExpandedState
将路径path的展开状态标记为isExpanded。- 指定由:
-
setExpandedState在类中AbstractLayoutCache - 参数:
-
path- 要展开或折叠的路径 -
isExpanded- 如果应展开路径,则为true,否则为false
-
getExpandedState
如果路径已展开且可见,则返回true。- 指定由:
-
getExpandedState在类中AbstractLayoutCache - 参数:
-
path- 正在查询的路径 - 返回:
- 如果路径已展开且可见,则返回true,否则返回false
-
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
-