- java.lang.Object
-
- javax.swing.tree.AbstractLayoutCache
-
- javax.swing.tree.FixedHeightLayoutCache
-
- 实现的所有接口
-
RowMapper
public class FixedHeightLayoutCache extends AbstractLayoutCache
注意:这将在以后的版本中变得更加开放。警告:此类的序列化对象与以后的Swing版本不兼容。 当前的序列化支持适用于运行相同版本Swing的应用程序之间的短期存储或RMI。 从1.4开始,
java.beans软件包中添加了对所有JavaBeansjava.beans长期存储的支持。 请参阅XMLEncoder。
-
-
嵌套类汇总
-
嵌套类/接口声明在类 javax.swing.tree.AbstractLayoutCache
AbstractLayoutCache.NodeDimensions
-
-
字段汇总
-
声明的属性在类 javax.swing.tree.AbstractLayoutCache
nodeDimensions, rootVisible, rowHeight, treeModel, treeSelectionModel
-
-
构造方法摘要
构造方法 构造器 描述 FixedHeightLayoutCache()构造一个FixedHeightLayoutCache。
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 RectanglegetBounds(TreePath path, Rectangle placeIn)返回一个矩形,给出绘制路径所需的边界。booleangetExpandedState(TreePath path)如果路径已展开且可见,则返回true。TreePathgetPathClosestTo(int x, int y)返回最接近x,y的节点的路径。TreePathgetPathForRow(int row)返回传入行的路径。intgetRowCount()返回可见行数。intgetRowForPath(TreePath path)返回路径中标识的最后一项可见的行。intgetVisibleChildCount(TreePath path)返回行的可见子项数。Enumeration<TreePath>getVisiblePathsFrom(TreePath path)返回一个枚举器,该枚举器在从传入位置开始的可见路径上递增。voidinvalidatePathBounds(TreePath path)什么都不做,FixedHeightLayoutCache没有缓存宽度,这就是所有可能改变的。voidinvalidateSizes()通知TreeState需要重新计算它引用的所有大小。booleanisExpanded(TreePath path)如果当前展开的行标识的值,则返回true。voidsetExpandedState(TreePath path, boolean isExpanded)标记路径path展开状态为isExpanded。voidsetModel(TreeModel newModel)设置将提供数据的TreeModel。voidsetRootVisible(boolean rootVisible)确定TreeModel中的根节点是否可见。voidsetRowHeight(int rowHeight)设置每个单元格的高度。voidtreeNodesChanged(TreeModelEvent e)在某个节点(或一组兄弟节点)以某种方式更改后调用。voidtreeNodesInserted(TreeModelEvent e)节点插入树后调用。voidtreeNodesRemoved(TreeModelEvent e)从树中删除节点后调用。voidtreeStructureChanged(TreeModelEvent e)在树从给定节点向下彻底更改结构之后调用。
-
-
-
方法详细信息
-
setModel
public void setModel(TreeModel newModel)
设置将提供数据的TreeModel。- 重写:
-
setModel类AbstractLayoutCache - 参数
-
newModel- 用于提供数据的TreeModel
-
setRootVisible
public void setRootVisible(boolean rootVisible)
确定TreeModel中的根节点是否可见。- 重写:
-
setRootVisible类AbstractLayoutCache - 参数
-
rootVisible- 如果要显示树的根节点,rootVisibletrue - 另请参见:
-
AbstractLayoutCache.rootVisible
-
setRowHeight
public void setRowHeight(int rowHeight)
设置每个单元格的高度。 如果rowHeight小于或等于0,则会抛出IllegalArgumentException。- 重写:
-
setRowHeight类AbstractLayoutCache - 参数
-
rowHeight- 每个单元格的高度(以像素为单位)
-
getRowCount
public int getRowCount()
返回可见行数。- Specified by:
-
getRowCount类AbstractLayoutCache - 结果
- 显示的行数
-
invalidatePathBounds
public void invalidatePathBounds(TreePath path)
什么都不做,FixedHeightLayoutCache没有缓存宽度,这就是所有可能改变的。- Specified by:
-
invalidatePathBounds类AbstractLayoutCache - 参数
-
path- 正在更新的路径
-
invalidateSizes
public void invalidateSizes()
通知TreeState需要重新计算它引用的所有大小。- Specified by:
-
invalidateSizes类AbstractLayoutCache
-
isExpanded
public boolean isExpanded(TreePath path)
如果当前展开的行标识的值,则返回true。- Specified by:
-
isExpanded类AbstractLayoutCache - 参数
-
path- 要检查的TreePath - 结果
- 是否扩展了TreePath
-
getBounds
public Rectangle getBounds(TreePath path, Rectangle placeIn)
返回一个矩形,给出绘制路径所需的边界。- Specified by:
-
getBounds类AbstractLayoutCache - 参数
-
path- 指定节点的TreePath -
placeIn- 提供可用空间的Rectangle对象 - 结果
- 指定要使用的空间的Rectangle对象
-
getPathForRow
public TreePath getPathForRow(int row)
返回传入行的路径。 如果row不可见,则返回null。- Specified by:
-
getPathForRow类AbstractLayoutCache - 参数
-
row- 正在查询的行 - 结果
-
给定行的
TreePath
-
getRowForPath
public int getRowForPath(TreePath path)
返回路径中标识的最后一项可见的行。 如果路径中的任何元素当前不可见,则返回-1。- Specified by:
-
getRowForPath类AbstractLayoutCache - 参数
-
path- 正在查询的TreePath - 结果
- 路径中最后一项可见的行,如果路径中的任何元素当前不可见,则为-1
-
getPathClosestTo
public TreePath getPathClosestTo(int x, int y)
返回最接近x,y的节点的路径。 如果当前没有任何内容可见,则返回null,否则它将始终返回有效路径。 如果你需要测试返回的对象是否正好在x,y,你应该获得返回路径的边界并测试x,y。- Specified by:
-
getPathClosestTo类AbstractLayoutCache - 参数
-
x- 所需位置的水平分量 -
y- 所需位置的垂直分量 - 结果
-
最接近指定点的
TreePath
-
getVisibleChildCount
public int getVisibleChildCount(TreePath path)
返回行的可见子项数。- Specified by:
-
getVisibleChildCount类AbstractLayoutCache - 参数
-
path- 正在查询的路径 - 结果
- 指定路径的可见子项数
-
getVisiblePathsFrom
public Enumeration<TreePath> getVisiblePathsFrom(TreePath path)
返回一个枚举器,该枚举器在从传入位置开始的可见路径上递增。 枚举的顺序基于路径的显示方式。- Specified by:
-
getVisiblePathsFrom类AbstractLayoutCache - 参数
-
path- 枚举的起始位置 - 结果
-
Enumerator从所需位置开始
-
setExpandedState
public void setExpandedState(TreePath path, boolean isExpanded)
标记路径path展开状态为isExpanded。- Specified by:
-
setExpandedState类AbstractLayoutCache - 参数
-
path- 正在展开或折叠的路径 -
isExpanded- 如果应扩展路径,isExpandedtrue,否则为false
-
getExpandedState
public boolean getExpandedState(TreePath path)
如果路径已展开且可见,则返回true。- Specified by:
-
getExpandedState类AbstractLayoutCache - 参数
-
path- 正在查询的路径 - 结果
- 如果路径已展开且可见,则为true,否则为false
-
treeNodesChanged
public void treeNodesChanged(TreeModelEvent e)
在某个节点(或一组兄弟节点)以某种方式更改后调用。 节点未更改树中的位置或更改其子阵列,但其他属性已更改并可能影响演示。 示例:文件名已更改,但它位于文件系统中的相同位置。
e.path()返回已更改节点的父节点的路径。
e.childIndices()返回已更改节点的索引。
- Specified by:
-
treeNodesChanged类AbstractLayoutCache - 参数
-
e-TreeModelEvent
-
treeNodesInserted
public void treeNodesInserted(TreeModelEvent e)
节点插入树后调用。
e.path()返回新节点的父节点
e.childIndices()以升序返回新节点的索引。
- Specified by:
-
treeNodesInserted类AbstractLayoutCache - 参数
-
e-TreeModelEvent
-
treeNodesRemoved
public void treeNodesRemoved(TreeModelEvent e)
从树中删除节点后调用。 请注意,如果从树中删除子树,则此方法可能仅针对已删除子树的根调用一次,而不是针对删除的每个单独兄弟集调用一次。
e.path()返回已删除节点的前父节点。
e.childIndices()返回节点在按升序删除之前的索引。
- Specified by:
-
treeNodesRemoved类AbstractLayoutCache - 参数
-
e-TreeModelEvent
-
treeStructureChanged
public void treeStructureChanged(TreeModelEvent e)
在树从给定节点向下彻底更改结构之后调用。 如果e.getPath()返回的路径长度为1且第一个元素未标识当前根节点,则第一个元素应成为树的新根。
e.path()保存节点的路径。
e.childIndices()返回null。
- Specified by:
-
treeStructureChanged类AbstractLayoutCache - 参数
-
e- theTreeModelEvent
-
-