模块 java.desktop

类 AsyncBoxView.ChildLocator

java.lang.Object
javax.swing.text.AsyncBoxView.ChildLocator
封闭类:
AsyncBoxView

public class AsyncBoxView.ChildLocator extends Object
一个类,用于在局部区域周围进行更改时管理局部区域中子视图的有效位置。 AsyncBoxView 可能会不断变化,但可见区域需要保持相当稳定,直到布局线程决定向父级发布更新。
自从:
1.3
  • 字段详细信息

    • lastValidOffset

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

      protected Rectangle  lastAlloc
      最后看到的分配(用于向上刷新更改时重新绘制)。
    • childAlloc

      protected Rectangle  childAlloc
      用于子分配的形状以避免产生大量垃圾。
  • 构造方法详细信息

    • ChildLocator

      public ChildLocator()
      构造一个子定位器。
  • 方法详情

    • 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)
      获取用于子视图的分配。 This does not update the offsets in the ChildState records.
      参数:
      index - 索引
      返回:
      用于子视图的分配
    • setAllocation

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

      protected int getViewIndexAtVisualOffset(float targetOffset)
      将负责沿长轴偏移到框中的视图定位。确保在 ChildState 对象上设置了偏移量,直到超过所需偏移量的给定目标跨度。
      参数:
      targetOffset - 目标偏移量
      返回:
      表示给定视觉位置 (targetOffset) 的视图索引,如果没有视图表示该位置,则为 -1