public class AsyncBoxView extends View
虽然子视图正在访问关联的文档上的读锁,因此在访问该模型时,该模型是稳定的。
Modifier and Type | Class and Description |
---|---|
class |
AsyncBoxView.ChildLocator
一个类来管理在局部区域中的子视图的有效位置,而正在改变局部区域的位置。
|
class |
AsyncBoxView.ChildState
表示子视图的布局状态的记录。
|
Modifier and Type | Field and Description |
---|---|
protected AsyncBoxView.ChildLocator |
locator
管理儿童的偏移的对象。
|
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Constructor and Description |
---|
AsyncBoxView(Element elem, int axis)
构建一个异步布局的框视图。
|
Modifier and Type | Method and Description |
---|---|
protected AsyncBoxView.ChildState |
createChildState(View v)
新的childstate记录被创建通过这种方法允许子类的扩展childstate记录做/持有更多
|
protected void |
flushRequirementChanges()
发布向上的首选项向父视图的更改。
|
float |
getBottomInset()
获取视图边缘的底部部分。
|
Shape |
getChildAllocation(int index, Shape a)
获取给定的子视图的配置。
|
protected AsyncBoxView.ChildState |
getChildState(int index)
取指定在给定索引处的子对象的布局状态的对象。
|
protected boolean |
getEstimatedMajorSpan()
是目前估计的主要跨度?
|
protected float |
getInsetSpan(int axis)
取沿轴是由间隔跨度。
|
protected LayoutQueue |
getLayoutQueue()
获取用于布局的队列。
|
float |
getLeftInset()
获取视图边缘的左部分。
|
int |
getMajorAxis()
取主要轴线(轴的孩子们沿着)。
|
float |
getMaximumSpan(int axis)
沿着一个轴确定该视图的最大跨度。
|
float |
getMinimumSpan(int axis)
沿着一个轴确定该视图的最小间距。
|
int |
getMinorAxis()
取小轴(轴垂直于拼接轴)。
|
int |
getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
提供了一种方法来确定下一步的直观模型,一个可能的地方插入位置。
|
float |
getPreferredSpan(int axis)
沿着一个轴确定该视图的首选跨度。
|
float |
getRightInset()
获取视图边缘的右边部分。
|
float |
getTopInset()
获得边缘的顶部周围的视图。
|
View |
getView(int n)
得到n子视图。
|
int |
getViewCount()
返回此视图中的视图数量。
|
int |
getViewIndex(int pos, Position.Bias b)
返回表示模型中给定位置的子视图索引。
|
protected int |
getViewIndexAtPosition(int pos, Position.Bias b)
把孩子的观点代表了指数模型中的位置。
|
protected void |
loadChildren(ViewFactory f)
加载所有的孩子来初始化视图。
|
protected void |
majorRequirementChange(AsyncBoxView.ChildState cs, float delta)
沿长轴方向改变的要求。
|
protected void |
minorRequirementChange(AsyncBoxView.ChildState cs)
沿小轴变化的要求。
|
Shape |
modelToView(int pos, Shape a, Position.Bias b)
提供从文档模型坐标空间到映射到它的视图的坐标空间的映射。
|
void |
paint(Graphics g, Shape alloc)
使用给定的分配和渲染表面渲染视图。
|
void |
preferenceChanged(View child, boolean width, boolean height)
孩子的看法可以称这对父母表示偏好发生了变化,应重新布局。
|
void |
replace(int offset, int length, View[] views)
调用父类的子视图的更新,并更新为孩子的状态记录。
|
void |
setBottomInset(float i)
设置视图的边缘的底部部分。
|
protected void |
setEstimatedMajorSpan(boolean isEstimated)
设置estimatedmajorspan性质是决定如果大跨度应视为估计。
|
void |
setLeftInset(float i)
设置视图的边缘的左边部分。
|
void |
setParent(View parent)
设置视图的父视图。
|
void |
setRightInset(float i)
设置视图的右侧边缘的右侧部分。
|
void |
setSize(float width, float height)
设置视图的大小。
|
void |
setTopInset(float i)
设置视图的边缘的顶部部分。
|
protected void |
updateLayout(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a)
响应来自模型的更改的通知更新布局。
|
int |
viewToModel(float x, float y, Shape a, Position.Bias[] biasReturn)
从视图坐标空间提供一个映射到模型的逻辑坐标空间。
|
append, breakView, changedUpdate, createFragment, forwardUpdate, forwardUpdateToView, getAlignment, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getResizeWeight, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, insertUpdate, isVisible, modelToView, modelToView, remove, removeAll, removeUpdate, updateChildren, viewToModel
protected AsyncBoxView.ChildLocator locator
public AsyncBoxView(Element elem, int axis)
elem
——模型的代表元素
axis
-轴瓦沿。这可以是x_axis或y_axis。
public int getMajorAxis()
public int getMinorAxis()
public float getTopInset()
public void setTopInset(float i)
i
-插图的价值
public float getBottomInset()
public void setBottomInset(float i)
i
-插图的价值
public float getLeftInset()
public void setLeftInset(float i)
i
-插图的价值
public float getRightInset()
public void setRightInset(float i)
i
-插图的价值
protected float getInsetSpan(int axis)
axis
-轴来确定总的插图,要么x_axis或y_axis。
protected void setEstimatedMajorSpan(boolean isEstimated)
protected boolean getEstimatedMajorSpan()
protected AsyncBoxView.ChildState getChildState(int index)
index
-孩子指数。这应该是一个价值> = 0 < getviewcount()。
protected LayoutQueue getLayoutQueue()
protected AsyncBoxView.ChildState createChildState(View v)
protected void majorRequirementChange(AsyncBoxView.ChildState cs, float delta)
这是实现标记的主要轴,因为改变了,使未来的检查,看看是否需要被发布到父视图将考虑的主要轴。如果沿长轴的跨度不估计,它是由给定的增量更新,以反映增量的变化。的三角洲被忽略,如果大跨度估计。
protected void minorRequirementChange(AsyncBoxView.ChildState cs)
protected void flushRequirementChanges()
public void replace(int offset, int length, View[] views)
protected void loadChildren(ViewFactory f)
setParent
方法。子类可以重新实现这个初始化以不同的方式,他们的孩子的观点。默认实现为每个子元素创建子视图。
在孩子们正在改变的情况下,通常一个写锁保存在文档上,从而保持渲染和布局线程的安全。例外的情况是当视图初始化为代表的现有元素(通过这种方法),所以它是同步的排除preferencechanged当我们初始化。
f
-看厂
setParent(javax.swing.text.View)
protected int getViewIndexAtPosition(int pos, Position.Bias b)
pos
--位置> = 0
protected void updateLayout(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a)
updateLayout
方法重写,继承类
View
ec
-更改元素这一观点负责(可能是null如果没有变化)。
e
-从相关文档的变更信息
a
-视图的当前配置
View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
,
View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
,
View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
public void setParent(View parent)
loadChildren
方法调用。孩子们不应该在构造函数中被加载,因为设置父母的行为可能会导致他们尝试搜索层次结构(例如获得托管容器)。如果这种观点有孩子(该视图是从一个地方到另一个层次的),
loadChildren
方法不会被调用。
public void preferenceChanged(View child, boolean width, boolean height)
preferenceChanged
方法重写,继承类
View
child
-子视图
width
-如果宽度偏好发生了变化
height
-如果身高偏好发生了变化
JComponent.revalidate()
public void setSize(float width, float height)
由于主要轴是异步更新的,应该是拼接的儿童的总和,呼叫被忽略的长轴。由于小轴是灵活的,工作是排队,以调整大小的儿童,如果小跨度的变化。
public void paint(Graphics g, Shape alloc)
这是实施以确定是否需要渲染的区域(即不限地区)是最新的或不。如果最新的孩子们。如果不是最新的,一个任务,以建立所需的区域被放置在布局队列作为一个高优先级的任务。这使事件线程渲染如果准备搬家,推迟到以后如果没有准备好(因为涂料的要求可以改期)。
paint
方法重写,继承类
View
g
-绘制表面使用
alloc
-分配区域进行渲染
View.paint(java.awt.Graphics, java.awt.Shape)
public float getPreferredSpan(int axis)
getPreferredSpan
方法重写,继承类
View
axis
-可能是view.x_axis或view.y_axis
IllegalArgumentException
-无效的轴型
View.getPreferredSpan(int)
public float getMinimumSpan(int axis)
getMinimumSpan
方法重写,继承类
View
axis
-可能是view.x_axis或view.y_axis
IllegalArgumentException
-无效的轴型
View.getPreferredSpan(int)
public float getMaximumSpan(int axis)
getMaximumSpan
方法重写,继承类
View
axis
-可能是view.x_axis或view.y_axis
IllegalArgumentException
-无效的轴型
View.getPreferredSpan(int)
public int getViewCount()
getViewCount
方法重写,继承类
View
View.getViewCount()
public View getView(int n)
public Shape getChildAllocation(int index, Shape a)
getChildAllocation
方法重写,继承类
View
index
-孩子的指数,>=0和<getviewcount()
a
-配置这一观点。
public int getViewIndex(int pos, Position.Bias b)
getViewIndex
方法重写,继承类
View
pos
--位置> = 0
public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException
modelToView
方法重写,继承类
View
pos
-位置转换> = 0
a
-分配区域进行渲染
b
-偏向前一个字符或下一个字符的偏移量表示,如果位置是两视图边界。
BadLocationException
-如果给定的位置不在相关文件表示一个有效的位置
IllegalArgumentException
-无效的偏置参数
View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])
public int viewToModel(float x, float y, Shape a, Position.Bias[] biasReturn)
这将是由图形用户界面线程调用的,并在关联的模型上保持一个读锁。它实现了定位子视图并确定它在childlocator对象锁分配的,并呼吁儿童观viewtomodel在childstate对象锁来避免线程交互与布局。
viewToModel
方法重写,继承类
View
x
- x坐标> = 0
y
- Y坐标> = 0
a
-分配区域进行渲染
public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet) throws BadLocationException
BadLocationException
。
getNextVisualPositionFrom
方法重写,继承类
View
pos
的位置转换
a
-分配区域进行渲染
direction
-这可以被认为是箭头键通常发现键盘上的当前位置的方向;这可能是下列之一:
SwingConstants.WEST
SwingConstants.EAST
SwingConstants.NORTH
SwingConstants.SOUTH
biasRet
-数组包含偏差检查
BadLocationException
-给定的位置不在有效的文档位置
IllegalArgumentException
-如果
direction
无效
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.