JavaTM 2 Platform
Standard Ed. 6

javax.swing.text
类 AsyncBoxView.ChildLocator

java.lang.Object
  继承者 javax.swing.text.AsyncBoxView.ChildLocator
正在封闭类:
AsyncBoxView

public class AsyncBoxView.ChildLocator
extends Object

该类在本地化区域发生更改时,管理该本地化区域中子视图的有效位置。AsyncBoxView 可能在不断地更改,但是在布局线程决定向父级发布更新之前,可见的区域需要保持相对的稳定。

从以下版本开始:
1.3

字段摘要
protected  Rectangle childAlloc
          用于子级分配区域以避免创建大量垃圾的形状。
protected  Rectangle lastAlloc
          最后的可见分配区域(用于向上刷新更改时进行重新绘制)。
protected  AsyncBoxView.ChildState lastValidOffset
          最后一次有效偏移量计算的位置。
 
构造方法摘要
AsyncBoxView.ChildLocator()
          构造 ChildLocator。
 
方法摘要
 void childChanged(AsyncBoxView.ChildState cs)
          子级已更改的通知。
protected  Shape getChildAllocation(int index)
          获取用于子视图的分配区域。
 Shape getChildAllocation(int index, Shape a)
          获取用于子视图的分配区域。
 int getViewIndexAtPoint(float x, float y, Shape a)
          获取位于给定点的子视图索引。
protected  int getViewIndexAtVisualOffset(float targetOffset)
          查找负责表示沿主轴方向框中偏移量位置的视图。
 void paintChildren(Graphics g)
          绘制与剪贴区域相交的子级。
protected  void setAllocation(Shape a)
          将当前已分配的形状复制到用于存储当前分配区域的 Rectangle 中。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

lastValidOffset

protected AsyncBoxView.ChildState lastValidOffset
最后一次有效偏移量计算的位置。


lastAlloc

protected Rectangle lastAlloc
最后的可见分配区域(用于向上刷新更改时进行重新绘制)。


childAlloc

protected Rectangle childAlloc
用于子级分配区域以避免创建大量垃圾的形状。

构造方法详细信息

AsyncBoxView.ChildLocator

public AsyncBoxView.ChildLocator()
构造 ChildLocator。

方法详细信息

childChanged

public void childChanged(AsyncBoxView.ChildState cs)
子级已更改的通知。无论是否需要新的偏移量计算这都有效。由已更改其主跨距的 ChildState 对象调用此方法。所以此方法可以由多个线程调用。


paintChildren

public void paintChildren(Graphics g)
绘制与剪贴区域相交的子级。


getChildAllocation

public Shape getChildAllocation(int index,
                                Shape a)
获取用于子视图的分配区域。这将更新那些位于给定索引之前尚未更新的所有子级的偏移量。


getViewIndexAtPoint

public int getViewIndexAtPoint(float x,
                               float y,
                               Shape a)
获取位于给定点的子视图索引。此方法由各种 View 方法调用,这些方法需要计算将消息转发到哪个子视图。这应该由在此对象上同步的代码块调用,并且通常应该后跟一个或多个对 getChildAllocation 的调用,该调用也应该在同步的代码块中进行。

参数:
x - X 坐标,该坐标 >= 0
y - Y 坐标,该坐标 >= 0
a - View 的分配区域
返回:
最近的子视图索引

getChildAllocation

protected Shape getChildAllocation(int index)
获取用于子视图的分配区域。这不更新 ChildState 记录中的偏移量。


setAllocation

protected void setAllocation(Shape a)
将当前已分配的形状复制到用于存储当前分配区域的 Rectangle 中。在特定于 Java2D 的实现中,这是一个浮点矩形。


getViewIndexAtVisualOffset

protected int getViewIndexAtVisualOffset(float targetOffset)
查找负责表示沿主轴方向框中偏移量位置的视图。确保在 ChildState 对象上设置的偏移量最高到超出所需偏移量的给定目标跨距。

返回:
表示给定可见位置的视图索引 (targetOffset),如果没有视图表示该位置,则返回 -1

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only