public abstract class AbstractLayoutCache extends Object implements RowMapper
java.beans包中。
请参阅XMLEncoder 。
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractLayoutCache.NodeDimensions
由
AbstractLayoutCache用于确定特定节点的大小和x原点。
|
| Modifier and Type | Field and Description |
|---|---|
protected AbstractLayoutCache.NodeDimensions |
nodeDimensions
负责获取节点大小的对象。
|
protected boolean |
rootVisible
如果显示根节点,则为真,如果子节点是最高可见节点,则为false。
|
protected int |
rowHeight
每行要使用的高度。
|
protected TreeModel |
treeModel
模型提供信息。
|
protected TreeSelectionModel |
treeSelectionModel
选择模式。
|
| Constructor and Description |
|---|
AbstractLayoutCache() |
| Modifier and Type | Method and Description |
|---|---|
abstract Rectangle |
getBounds(TreePath path, Rectangle placeIn)
返回一个给出绘制路径所需边界的矩形。
|
abstract boolean |
getExpandedState(TreePath path)
如果路径被展开且可见,则返回true。
|
TreeModel |
getModel()
返回
TreeModel所提供的数据。
|
AbstractLayoutCache.NodeDimensions |
getNodeDimensions()
返回呈现树中节点的对象,负责计算各个节点的维度。
|
protected Rectangle |
getNodeDimensions(Object value, int row, int depth, boolean expanded, Rectangle placeIn)
返回时,通过在参考
placeIn ,所需要的尺寸来表示
value 。
|
abstract TreePath |
getPathClosestTo(int x, int y)
返回最接近x,y的节点的路径。
|
abstract TreePath |
getPathForRow(int row)
返回在行中传递的路径。
|
int |
getPreferredHeight()
返回首选高度。
|
int |
getPreferredWidth(Rectangle bounds)
返回传入区域的首选宽度。
|
abstract int |
getRowCount()
显示的行数
|
abstract int |
getRowForPath(TreePath path)
返回在路径中识别的最后一个项目可见的行。
|
int |
getRowHeight()
返回每行的高度。
|
int[] |
getRowsForPaths(TreePath[] paths)
返回该行
TreePath的情况下
path正在以显示。
|
TreeSelectionModel |
getSelectionModel()
返回用于维护选择的模型。
|
abstract int |
getVisibleChildCount(TreePath path)
返回行的可见子项数。
|
abstract Enumeration<TreePath> |
getVisiblePathsFrom(TreePath path)
返回一个
Enumerator ,从传入的位置开始,以可见路径递增。
|
abstract void |
invalidatePathBounds(TreePath path)
指示
LayoutCache ,对于边界
path是无效的,并需要进行更新。
|
abstract void |
invalidateSizes()
通知
TreeState它需要重新计算它所引用的所有大小。
|
abstract boolean |
isExpanded(TreePath path)
如果当前标识的值目前已被扩展,则返回true。
|
protected boolean |
isFixedRowHeight()
如果每行的高度是固定大小,则返回true。
|
boolean |
isRootVisible()
如果显示树的根节点,则返回true。
|
abstract void |
setExpandedState(TreePath path, boolean isExpanded)
标记路径
path扩展状态为
isExpanded 。
|
void |
setModel(TreeModel newModel)
设置将提供数据的
TreeModel 。
|
void |
setNodeDimensions(AbstractLayoutCache.NodeDimensions nd)
设置负责绘制树中节点的渲染器,因此负责计算各个节点的维度。
|
void |
setRootVisible(boolean rootVisible)
确定来自
TreeModel是否可见。
|
void |
setRowHeight(int rowHeight)
设置每个单元格的高度。
|
void |
setSelectionModel(TreeSelectionModel newLSM)
设置
TreeSelectionModel用于管理选择新的LSM。
|
abstract void |
treeNodesChanged(TreeModelEvent e)
节点(或一组兄弟节点)以某种方式更改后调用。
|
abstract void |
treeNodesInserted(TreeModelEvent e)
在节点插入到树中之后调用。
|
abstract void |
treeNodesRemoved(TreeModelEvent e)
从树中删除节点后调用。
|
abstract void |
treeStructureChanged(TreeModelEvent e)
在树已经从给定节点大幅度改变结构之后调用。
|
protected AbstractLayoutCache.NodeDimensions nodeDimensions
protected TreeModel treeModel
protected TreeSelectionModel treeSelectionModel
protected boolean rootVisible
protected int rowHeight
public void setNodeDimensions(AbstractLayoutCache.NodeDimensions nd)
nd - 一个
NodeDimensions对象
public AbstractLayoutCache.NodeDimensions getNodeDimensions()
NodeDimensions对象
public void setModel(TreeModel newModel)
TreeModel 。
newModel - 那是提供数据的
TreeModel
public TreeModel getModel()
TreeModel所提供的数据。
TreeModel正在提供数据
public void setRootVisible(boolean rootVisible)
TreeModel是否可见。
rootVisible - 如果要显示树的根节点,则为true
rootVisible
public boolean isRootVisible()
rootVisible
public void setRowHeight(int rowHeight)
rowHeight - 每个单元格的高度,以像素为单位
public int getRowHeight()
public void setSelectionModel(TreeSelectionModel newLSM)
TreeSelectionModel用于管理选择新的LSM。
newLSM - 全新
TreeSelectionModel
public TreeSelectionModel getSelectionModel()
treeSelectionModel
public int getPreferredHeight()
public int getPreferredWidth(Rectangle bounds)
(bounds.x, bounds.y)和结束于bounds.height + bounds.y 。
如果bounds为null ,则所有节点的首选宽度将被返回(这可能是非常昂贵的计算)。
bounds - 被查询的地区
public abstract boolean isExpanded(TreePath path)
public abstract Rectangle getBounds(TreePath path, Rectangle placeIn)
path - 一个
TreePath节点的
TreePath
placeIn - 提供可用空间的
Rectangle对象
Rectangle要使用的空间的
Rectangle对象
public abstract TreePath getPathForRow(int row)
null返回。
row - 正在查询的行
TreePath
public abstract int getRowForPath(TreePath path)
path - 被查询的
TreePath
public abstract TreePath getPathClosestTo(int x, int y)
null ,否则它将始终返回一个有效的路径。
如果您需要测试返回的对象是否完全在x处,那么您应该获得返回路径的边界,并对其进行测试x,y。
x - 所需位置的水平分量
y - 所需位置的垂直分量
TreePath最接近指定点
public abstract Enumeration<TreePath> getVisiblePathsFrom(TreePath path)
Enumerator ,从传入的位置开始可见的路径递增。
枚举的顺序是基于路径的显示方式。
返回的枚举的第一个元素将是路径,除非它不可见,在这种情况下将返回null 。
path -
path的起始位置
Enumerator从所需位置开始
public abstract int getVisibleChildCount(TreePath path)
path - 被查询的路径
public abstract void setExpandedState(TreePath path, boolean isExpanded)
path扩展状态为
isExpanded 。
path - 正在扩展或折叠的路径
isExpanded - 如果路径应该展开,则为true,否则为false
public abstract boolean getExpandedState(TreePath path)
path - 被查询的路径
public abstract int getRowCount()
public abstract void invalidateSizes()
TreeState它需要重新计算它所引用的所有大小。
public abstract void invalidatePathBounds(TreePath path)
LayoutCache ,对于边界
path是无效的,并需要进行更新。
path - 正在更新的路径
public abstract void treeNodesChanged(TreeModelEvent e)
节点(或一组兄弟节点)以某种方式更改后调用。 节点没有更改树中的位置或更改其子数组,但其他属性已更改,并可能影响演示。 示例:文件的名称已更改,但它位于文件系统中的相同位置。
e.path()返回已更改节点的父节点的路径。
e.childIndices()返回已更改节点的索引(es)。
e -
TreeModelEvent
public abstract void treeNodesInserted(TreeModelEvent e)
在节点插入到树中之后调用。
e.path()返回新节点的父节点
e.childIndices()按升序返回新节点的索引。
e -
TreeModelEvent
public abstract void treeNodesRemoved(TreeModelEvent e)
从树中删除节点后调用。 请注意,如果从树中删除子树,则此方法只能针对已删除的子树的根调用一次,而对于删除的每个单独的一组兄弟,则不能一次。
e.path()返回已删除节点的前一个父节点。
e.childIndices()返回节点在按升序删除之前的索引。
e -
TreeModelEvent
public abstract void treeStructureChanged(TreeModelEvent e)
在树已经从给定节点大幅度改变结构之后调用。 如果由e.getPath()返回的路径长度为1,第一个元素不标识当前根节点,则第一个元素应该成为树的新根。
e.path()保存节点的路径。
e.childIndices()返回null。
e -
TreeModelEvent
public int[] getRowsForPaths(TreePath[] paths)
TreePath的情况下path正在以显示。
该方法应该返回与传入的数据相同长度的数组,如果TreePaths中的一个path不正确,则其数组中的条目应设置为-1。
getRowsForPaths在界面
RowMapper
paths - 正在查询的
TreePath的数组
TreePath的行;
如果paths是null ,则返回null
protected Rectangle getNodeDimensions(Object value, int row, int depth, boolean expanded, Rectangle placeIn)
placeIn ,所需要的尺寸来表示value 。
如果inPlace为null ,则应重新创建Rectangle ,否则返回值为inPlace 。
如果没有渲染器,这将返回null 。
value -的
value被表示
row - 正在查询的行
depth - 行的深度
expanded - 如果行被展开,则为true,否则为false
placeIn -一个
Rectangle含有表示所需的大小
value
Rectangle包含节点的尺寸,或
null如果节点没有尺寸
protected boolean isFixedRowHeight()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.