- java.lang.Object
-
- javax.swing.text.AsyncBoxView.ChildLocator
-
- Enclosing class:
- AsyncBoxView
public class AsyncBoxView.ChildLocator extends Object
在本地化区域内进行变更时,可以管理子视图在局部区域中的有效位置。 AsyncBoxView可能会不断更改,但可见区域需要保持相当稳定,直到布局线程决定向父级发布更新。- 从以下版本开始:
- 1.3
-
-
Field Summary
Fields Modifier and Type Field 描述 protected RectanglechildAlloc用于子分配的形状,以避免产生大量的垃圾。protected RectanglelastAlloc最后看到的分配(当更改被刷新时重新绘制)。protected AsyncBoxView.ChildStatelastValidOffset上次偏移计算的位置有效。
-
构造方法摘要
构造方法 Constructor 描述 ChildLocator()构建一个子定位器。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 voidchildChanged(AsyncBoxView.ChildState cs)通知孩子改变了。protected ShapegetChildAllocation(int index)获取用于子视图的分配。ShapegetChildAllocation(int index, Shape a)获取用于子视图的分配。intgetViewIndexAtPoint(float x, float y, Shape a)在给定点获取子视图索引。protected intgetViewIndexAtVisualOffset(float targetOffset)将负责偏移的视图定位到沿主轴的框中。voidpaintChildren(Graphics g)绘制与剪辑区域相交的孩子。protected voidsetAllocation(Shape a)将当前分配的形状复制到用于存储当前分配的Rectangle中。
-
-
-
字段详细信息
-
lastValidOffset
protected AsyncBoxView.ChildState lastValidOffset
上次偏移计算的位置有效。
-
lastAlloc
protected Rectangle lastAlloc
最后看到的分配(当更改被刷新时重新绘制)。
-
childAlloc
protected Rectangle childAlloc
用于子分配的形状,以避免产生大量的垃圾。
-
-
方法详细信息
-
childChanged
public void childChanged(AsyncBoxView.ChildState cs)
通知孩子改变了。 无论是否需要新的偏移计算,这都可以起作用。 这被一个已经改变它的主要跨度的ChildState对象调用。 这可以由多个线程调用。- 参数
-
cs- 小孩状态
-
paintChildren
public void paintChildren(Graphics g)
绘制与剪辑区域相交的孩子。- 参数
-
g- 要使用的渲染表面
-
getChildAllocation
public Shape getChildAllocation(int index, Shape a)
获取用于子视图的分配。 这将更新给定索引之前尚未更新的所有子项的偏移量。- 参数
-
index- 子索引 -
a- 分配 - 结果
- 用于子视图的分配
-
getViewIndexAtPoint
public int getViewIndexAtPoint(float x, float y, Shape a)在给定点获取子视图索引。 这是通过各种View方法调用的,需要计算哪个小孩转发消息。 应该通过在该对象上同步的块来调用该对象,并且通常将跟随一个或多个调用getChildAllocation(也应该位于同步块中)。- 参数
-
x- X坐标> = 0 -
y- Y坐标> = 0 -
a- 分配给视图 - 结果
- 最近的子索引
-
getChildAllocation
protected Shape getChildAllocation(int index)
获取用于子视图的分配。 这不会更新ChildState记录中的偏移量。- 参数
-
index- 指数 - 结果
- 用于子视图的分配
-
setAllocation
protected void setAllocation(Shape a)
将当前分配的形状复制到用于存储当前分配的Rectangle中。 这将是Java2D特定实现中的浮点矩形。- 参数
-
a- 分配
-
getViewIndexAtVisualOffset
protected int getViewIndexAtVisualOffset(float targetOffset)
将负责偏移的视图定位到沿主轴的框中。 确保在直到给定目标跨越所需偏移量的ChildState对象上设置偏移量。- 参数
-
targetOffset- 目标偏移量 - 结果
- 表示给定视觉位置(targetOffset)的视图的索引,如果没有视图表示该位置,则为-1
-
-