public class ParagraphView extends FlowView implements TabExpander
breakView方法叫做尝试雕刻成合适的角度。
View
FlowView.FlowStrategy| Modifier and Type | Field and Description |
|---|---|
protected int |
firstLineIndent
对于第一行缩进,从左上角。
|
layoutPool, layoutSpan, strategyBadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXISBOTTOM, 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 |
|---|
ParagraphView(Element elem)
构建了一个给定的元素
ParagraphView。
|
| Modifier and Type | Method and Description |
|---|---|
View |
breakView(int axis, float len, Shape a)
将此视图在给定长度上打破这个视图。
|
protected SizeRequirements |
calculateMinorAxisRequirements(int axis, SizeRequirements r)
沿小轴计算段落的需要。
|
void |
changedUpdate(DocumentEvent changes, Shape a, ViewFactory f)
从该视图负责的位置上更改属性的文档的通知。
|
protected View |
createRow()
创建一个
View应用于流量保持一一排的孩子。
|
protected int |
findOffsetToCharactersInString(char[] string, int start)
在
string字符文件查找下一个字符,从偏
start。
|
protected boolean |
flipEastAndWestAtEnds(int position, Position.Bias bias)
确定下一个视图的方向。
|
float |
getAlignment(int axis)
沿着一个轴确定此视图所需的对齐方式。
|
int |
getBreakWeight(int axis, float len)
获取给定位置的中断权重。
|
protected int |
getClosestPositionTo(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet, int rowIndex, int x)
返回最近的位置
x模型。
|
int |
getFlowSpan(int index)
取制约跨流对给定的子索引。
|
int |
getFlowStart(int index)
取沿流轴流跨将开始在该位置。
|
protected View |
getLayoutView(int index)
返回在给定的
index观。
|
protected int |
getLayoutViewCount()
返回此视图负责的视图的数量。
|
protected int |
getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
返回光标的下一个视觉位置,无论是在东部或西部方向。
|
protected float |
getPartialSize(int startOffset, int endOffset)
返回的
startOffset和
endOffset视图之间的尺寸。
|
protected float |
getTabBase()
返回标签计算的地方。
|
protected TabSet |
getTabSet()
得到
Tabset用来计算标签。
|
float |
nextTabStop(float x, int tabOffset)
返回给定参考位置的下一个制表位停止位置。
|
void |
paint(Graphics g, Shape a)
使用给定的渲染表面和表面上的区域。
|
protected void |
setFirstLineIndent(float fi)
设置在第一行缩进。
|
protected void |
setJustification(int j)
设置理由的类型。
|
protected void |
setLineSpacing(float ls)
设置行间距。
|
protected void |
setPropertiesFromAttributes()
从属性设置缓存属性。
|
getFlowAxis, getViewIndexAtPosition, insertUpdate, layout, loadChildren, removeUpdate, setParentbaselineLayout, baselineRequirements, calculateMajorAxisRequirements, childAllocation, forwardUpdate, getAxis, getChildAllocation, getHeight, getMaximumSpan, getMinimumSpan, getOffset, getPreferredSpan, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paintChild, preferenceChanged, replace, setAxis, setSize, viewToModelgetBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, modelToView, setInsets, setParagraphInsetsappend, breakView, createFragment, forwardUpdateToView, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, isVisible, modelToView, remove, removeAll, updateChildren, updateLayout, viewToModelpublic ParagraphView(Element elem)
ParagraphView。
elem -这一观点负责元
protected void setJustification(int j)
j -以下值之一:
StyleConstants.ALIGN_LEFTStyleConstants.ALIGN_CENTERStyleConstants.ALIGN_RIGHTprotected void setLineSpacing(float ls)
ls -价值线的高度的一个因素
protected void setFirstLineIndent(float fi)
fi -点的值
protected void setPropertiesFromAttributes()
protected int getLayoutViewCount()
Views排片。这是已在两个维度中被拼接的视图的数量,并且应该相当于这个视图的元素的子元素的数量。
ParagraphView负责数
protected View getLayoutView(int index)
index观。这段的子视图是用来安排的
Views表示子元素的排片。此方法返回负责子元素索引(在断开之前)的视图。这些都是从工厂生产的视图(代表子元素)和用于布局。
index -理想观的
index
index观
protected int getNextNorthSouthVisualPositionFrom(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet)
throws BadLocationException
CompositeView重写。
getNextNorthSouthVisualPositionFrom 方法重写,继承类
CompositeView
pos位置到模型
b -
Position.Bias.Forward或
Position.Bias.Backward
a -分配区域进行渲染
direction -
SwingConstants.NORTH或
SwingConstants.SOUTH
biasRet -一个数组包含的偏见,这种方法检查
BadLocationException
CompositeView.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[])
protected int getClosestPositionTo(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet,
int rowIndex,
int x)
throws BadLocationException
x模型。
rowIndex给出对应,应该看在索引视图。
pos位置到模型
a -分配区域进行渲染
direction -以下值之一:
SwingConstants.NORTHSwingConstants.SOUTHbiasRet -一个数组包含的偏见,这种方法检查
rowIndex -视图的索引
x -感兴趣的X坐标
x
BadLocationException
protected boolean flipEastAndWestAtEnds(int position,
Position.Bias bias)
Views布局从左到右考虑
View,使
View向东将在指数n + 1,和
View向西将指数n - 1。在某些情况下,如双向文本,它是可能的,
View东不在指数n + 1,而是在指数n - 1,或者说,
View向西是不是指数n - 1,但指数n + 1。在这种情况下,此方法将返回true,表示
Views布局排列。
这会如果文本布局左位右返回true,否则为false。
flipEastAndWestAtEnds 方法重写,继承类
BoxView
position位置到模型
bias -
Position.Bias.Forward或
Position.Bias.Backward
public int getFlowSpan(int index)
getFlowSpan 方法重写,继承类
FlowView
index -视图的查询索引
index
FlowView.getFlowStart(int)
public int getFlowStart(int index)
getFlowStart 方法重写,继承类
FlowView
index -视图的查询索引
index为给定的视图的位置
FlowView.getFlowSpan(int)
protected View createRow()
View应用于流量保持一一排的孩子。
public float nextTabStop(float x,
int tabOffset)
getTabbedSpan在布局过程逻辑的孩子确定孩子所需的跨度。逻辑上的孩子可以将他们的标签扩展到向上的段落,知道如何扩大标签。
LabelView是视图,代表其标签扩展需要向段为例。
这是实施尝试在段落元素的属性定位TabSet集。如果可以找到一个,它的设置将被使用,否则将提供一个默认的扩展。左缩进段落的最新配置是基础定位为Tab扩展(这是什么孩子的布局是根据)。
nextTabStop 接口
TabExpander
x - X参考位置
tabOffset -文本流标签出现在> = 0的位置
TabSet,
TabStop,
LabelView
protected TabSet getTabSet()
Tabset用来计算标签。
TabSet
protected float getPartialSize(int startOffset,
int endOffset)
startOffset和
endOffset视图之间的尺寸。这种利用
getPartialView如果孩子视图实现
TabableView界面计算尺寸。如果需要,
View未实现
TabableView接口,将使用的
preferredSpan。
startOffset -启动文件偏移> = 0
endOffset -结尾的文件偏移> = startOffset
protected int findOffsetToCharactersInString(char[] string,
int start)
string字符文件查找下一个字符,从偏
start。如果没有人发现,1将返回。
string -字符串
start -在模型> = 0开始
protected float getTabBase()
public void paint(Graphics g, Shape a)
paint 方法重写,继承类
BoxView
g -绘制表面使用
a -分配区域进行渲染
View.paint(java.awt.Graphics, java.awt.Shape)
public float getAlignment(int axis)
getAlignment 方法重写,继承类
BoxView
axis -可能是
View.X_AXIS或
View.Y_AXIS
public View breakView(int axis, float len, Shape a)
ParagraphView情况下只能沿Y_AXIS易碎,如果len是第一行后。
axis -可能是
View.X_AXIS或
View.Y_AXIS
len -指定其中一个潜在的突破需要沿给定轴> = 0
a -视图的当前配置
View.breakView(int, int, float, float)
public int getBreakWeight(int axis,
float len)
ParagraphView情况下只能沿Y_AXIS易碎,如果len是先行后列。如果长度不超过一行,BadBreakWeight返回值。
axis -可能是
View.X_AXIS或
View.Y_AXIS
len -指定其中一个潜在的突破需要> = 0
GoodBreakWeight或
BadBreakWeight
View.getBreakWeight(int, float, float)
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
使用父类的尺寸要求,修改,考虑到非易碎的区域在相邻的视图的边缘。这种意见的最小尺寸要求应不小于所有相邻片段的总和。
如果axis参数不View.X_AXIS也View.Y_AXIS,IllegalArgumentException抛出。如果r参数null,新SizeRequirements对象被创建,否则提供SizeRequirements对象返回。
calculateMinorAxisRequirements 方法重写,继承类
FlowView
axis -短轴
r -输入
SizeRequirements对象
SizeRequirements对象
IllegalArgumentException -如果
axis参数无效
SizeRequirements
public void changedUpdate(DocumentEvent changes, Shape a, ViewFactory f)
changedUpdate 方法重写,继承类
FlowView
changes -从相关文档的变更信息
a -视图的当前配置
f -工厂用重建如果视图有孩子
View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
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.