- java.lang.Object
 -  
      
- javax.swing.text.AsyncBoxView.ChildLocator
 
 
-  
       
- Enclosing class:
 - AsyncBoxView
 
public class AsyncBoxView.ChildLocator extends Object
在本地化区域周围进行更改时,用于管理局部区域中子视图的有效位置的类。 AsyncBoxView可能会不断变化,但可见区域需要保持相当稳定,直到布局线程决定向父级发布更新。- 从以下版本开始:
 - 1.3
 
 
-  
        
       
-  
             
字段汇总
字段 变量和类型 字段 描述 protected RectanglechildAlloc用于子分配的形状,以避免产生大量垃圾。protected RectanglelastAlloc最后看到的分配(用于在向上刷新更改时重新绘制)。protected AsyncBoxView.ChildStatelastValidOffset最后一次偏移计算的位置是有效的。 
-  
             
构造方法摘要
构造方法 构造器 描述 ChildLocator()构建一个儿童定位器。 
-  
             
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 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的一个或多个调用,该调用也应该在synchronized块中。- 参数
 -  
              
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
 
 
 -  
 
 -