|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.swing.text.View
javax.swing.text.CompositeView
javax.swing.text.BoxView
javax.swing.text.FlowView
javax.swing.text.ParagraphView
public class ParagraphView
存在简单换行的段落的视图,其支持多种字体、颜色、组件、图标等。它基本上是周围有空白的纵向框。该框的内容是一组行,这些行是特殊的横向框。此视图创建表示段落元素的子元素的视图集合。如果这些视图合适,则可将其中的每个视图直接放到行中;否则,将调用 breakView 方法尝试将视图切割成合适的片段。
View| 嵌套类摘要 |
|---|
| 从类 javax.swing.text.FlowView 继承的嵌套类/接口 |
|---|
FlowView.FlowStrategy |
| 字段摘要 | |
|---|---|
protected int |
firstLineIndent
相对于左边的 inset 进行的第一行的缩进。 |
| 从类 javax.swing.text.FlowView 继承的字段 |
|---|
layoutPool, layoutSpan, strategy |
| 从类 javax.swing.text.View 继承的字段 |
|---|
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS |
| 从接口 javax.swing.SwingConstants 继承的字段 |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| 构造方法摘要 | |
|---|---|
ParagraphView(Element elem)
创建给定元素的 ParagraphView。 |
|
| 方法摘要 | |
|---|---|
protected void |
adjustRow(javax.swing.text.ParagraphView.Row r,
int desiredSpan,
int x)
如有可能,调整给定行以使其处于布局区域内。 |
View |
breakView(int axis,
float len,
Shape a)
以给定的长度在给定的轴上拆分此视图。 |
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()
从属性集设置缓存的属性。 |
| 从类 javax.swing.text.FlowView 继承的方法 |
|---|
calculateMinorAxisRequirements, getFlowAxis, getViewIndexAtPosition, insertUpdate, layout, loadChildren, removeUpdate, setParent |
| 从类 javax.swing.text.View 继承的方法 |
|---|
append, breakView, createFragment, forwardUpdateToView, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, isVisible, modelToView, remove, removeAll, updateChildren, updateLayout, viewToModel |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
protected int firstLineIndent
| 构造方法详细信息 |
|---|
public ParagraphView(Element elem)
ParagraphView。
elem - 此视图负责的元素| 方法详细信息 |
|---|
protected void setJustification(int j)
j - 为下列值之一:
StyleConstants.ALIGN_LEFT
StyleConstants.ALIGN_CENTER
StyleConstants.ALIGN_RIGHT
protected void setLineSpacing(float ls)
ls - 该值为行高的因子protected void setFirstLineIndent(float fi)
fi - 以磅 (point) 为单位的值protected void setPropertiesFromAttributes()
protected int getLayoutViewCount()
View 片段的行。这是平铺在两个维数之间的视图数,此数应等于此视图负责的元素的子元素数。
ParagraphView 负责的视图数protected View getLayoutView(int index)
index 处的视图。段落的子视图是已用于安排表示子元素的 View 片段的行。此方法返回负责子元素索引的视图(拆分前)。这些是从工厂生成(以表示子元素)且用于布局的 View。
index - 所需视图的 index
index 处的视图
protected void adjustRow(javax.swing.text.ParagraphView.Row r,
int desiredSpan,
int x)
这是内部用法,不应直接使用。
r - 要调整到当前布局区域内的行desiredSpan - 当前布局区域,该值 >= 0x - r 开始处的位置
protected int getNextNorthSouthVisualPositionFrom(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet)
throws BadLocationException
CompositeView 重写。
CompositeView 中的 getNextNorthSouthVisualPositionFrompos - 模型中的位置b - Position.Bias.Forward 或 Position.Bias.Backwarda - 要呈现的分配区域direction - SwingConstants.NORTH 或 SwingConstants.SOUTHbiasRet - 包含以此方法查到的偏差的数组
BadLocationExceptionCompositeView.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.NORTH
SwingConstants.SOUTH
biasRet - 包含在此方法中查到的偏差的数组rowIndex - 视图的索引x - 需要的 x 坐标
x 的模型位置
BadLocationException
protected boolean flipEastAndWestAtEnds(int position,
Position.Bias bias)
View 位于索引 n 处,通常 View 是从左向右放置的,所以在东面的 View 将位于索引 n + 1 处,在西面的 View 将位于索引 n - 1 处。在某些情况下(例如双向文本中)有可能东面的 View 不是位于 n + 1 处,而是位于 n - 1 处,或者西面的 View 不是位于 n - 1 处,而是位于索引 n + 1 处。这种情况下,该方法将返回 true,指示 View 按降序放置。
如果文本在某个位置从右向左布置,则返回 true;否则返回 false。
BoxView 中的 flipEastAndWestAtEndsposition - 模型中的位置bias - Position.Bias.Forward 或 Position.Bias.Backward
public int getFlowSpan(int index)
FlowView 中的 getFlowSpanindex - 查询视图的索引
index 处给定视图的约束区域FlowView.getFlowStart(int)public int getFlowStart(int index)
FlowView 中的 getFlowStartindex - 查询视图的索引
index 处给定视图的位置FlowView.getFlowSpan(int)protected View createRow()
View。
FlowView 中的 createRowView
public float nextTabStop(float x,
int tabOffset)
getTabbedSpan,以确定该子级所需的区域。逻辑子级可以将其制表符扩展委托给知道如何扩展制表符的段落。LabelView 是将其制表符扩展需要委托给段落的视图的示例。
实现此方法以尝试在段落元素的属性集合中查找 TabSet。如果能找到一个制表符集,将使用其设置;否则将提供默认扩展。制表符扩展的基本位置是段落左部最近分配的位置(即子级布局的依据)。
TabExpander 中的 nextTabStopx - X 引用位置tabOffset - 在文本流内放置制表符的位置,该值 >= 0
TabSet,
TabStop,
LabelViewprotected TabSet getTabSet()
Tabset。
TabSet
protected float getPartialSize(int startOffset,
int endOffset)
startOffset 和 endOffset 之间的视图使用的大小。如果子视图实现 TabableView 接口,则此方法将使用 getPartialView 计算该大小。如果需要某个大小,并且 View 未实现 TabableView 接口,则使用 preferredSpan。
startOffset - 起始文档偏移量,该值 >= 0endOffset - 结束文档偏移量,该值 >= startOffset
protected int findOffsetToCharactersInString(char[] string,
int start)
string 中字符查找文档中的下一个字符,起点是偏移量 start。如果找不到字符,则返回 -1。
string - 由字符组成的字符串start - 模型中的起始位置,该值 >= 0
protected float getTabBase()
public void paint(Graphics g,
Shape a)
BoxView 中的 paintg - 要使用的呈现表面a - 分配的要在其中呈现的区域View.paint(java.awt.Graphics, java.awt.Shape)public float getAlignment(int axis)
BoxView 中的 getAlignmentaxis - 可以是 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_AXISlen - 指定沿给定轴可能需要拆分的位置,该值 >= 0a - 视图的当前分配区域
View.breakView(int, int, float, float)
public int getBreakWeight(int axis,
float len)
ParagraphView 实例只沿 Y_AXIS 且只在 len 位于第一行之后拆分。如果长度小于一行,则返回 BadBreakWeight 的值。
axis - 可以是 View.X_AXIS,也可以是 View.Y_AXISlen - 指定可能需要拆分的位置,该值 >= 0
GoodBreakWeight 或 BadBreakWeightView.getBreakWeight(int, float, float)
public void changedUpdate(DocumentEvent changes,
Shape a,
ViewFactory f)
FlowView 中的 changedUpdatechanges - 来自相关文档的更改信息a - 视图的当前分配区域f - 用于重建的工厂(如果该视图有子级)View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。