public class WrappedPlainView extends BoxView implements TabExpander
线的观点做他们所有的渲染,通过drawLine方法反过来做所有的渲染,通过drawSelectedText和drawUnselectedText方法。这使子类可以很容易地专注于渲染,而不需要考虑布局方面。
View
BadBreakWeight, 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 |
|---|
WrappedPlainView(Element elem)
创建一个新的wrappedplainview。
|
WrappedPlainView(Element elem, boolean wordWrap)
创建一个新的wrappedplainview。
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
calculateBreakPosition(int p0, int p1)
这是由嵌套的包线视图调用,以确定中断位置。
|
void |
changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
从该视图负责的位置上更改属性的文档的通知。
|
protected void |
drawLine(int p0, int p1, Graphics g, int x, int y)
显示一行文字,抑制空白末和扩大任何标签。
|
protected int |
drawSelectedText(Graphics g, int x, int y, int p0, int p1)
以选定的文本呈现模型中的给定范围。
|
protected int |
drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
将给定的范围内,为正常模式选中的文本。
|
protected Segment |
getLineBuffer()
提供访问可用于从相关文档获取文本的缓冲区。
|
float |
getMaximumSpan(int axis)
沿着一个轴确定该视图的最大跨度。
|
float |
getMinimumSpan(int axis)
沿着一个轴确定该视图的最小间距。
|
float |
getPreferredSpan(int axis)
沿着一个轴确定该视图的首选跨度。
|
protected int |
getTabSize()
返回设置文档标签的大小,默认为8。
|
void |
insertUpdate(DocumentEvent e, Shape a, ViewFactory f)
给出了一个在该视图负责的位置上插入到文档中的通知。
|
protected void |
loadChildren(ViewFactory f)
加载所有的孩子来初始化视图。
|
float |
nextTabStop(float x, int tabOffset)
返回给定的参考位置后的下一个制表位停止位置。
|
void |
paint(Graphics g, Shape a)
使用给定的渲染表面和表面上的区域。
|
void |
removeUpdate(DocumentEvent e, Shape a, ViewFactory f)
给予通知,该视图是由该视图负责的位置中的某个文件被删除的。
|
void |
setSize(float width, float height)
设置视图的大小。
|
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, calculateMinorAxisRequirements, childAllocation, flipEastAndWestAtEnds, forwardUpdate, getAlignment, getAxis, getChildAllocation, getHeight, getOffset, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layout, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paintChild, preferenceChanged, replace, setAxis, viewToModelgetBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, getViewIndexAtPosition, modelToView, setInsets, setParagraphInsets, setParentappend, breakView, createFragment, forwardUpdateToView, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, isVisible, modelToView, remove, removeAll, updateChildren, updateLayout, viewToModelpublic WrappedPlainView(Element elem)
elem -基本视图的元素
public WrappedPlainView(Element elem, boolean wordWrap)
elem -基本视图的元素
wordWrap应该系被包裹在单词边界?
protected int getTabSize()
protected void drawLine(int p0,
int p1,
Graphics g,
int x,
int y)
drawUnselectedText和
drawSelectedText,选中和未选中的文本方式提供可定制。
p0 -启动文件位置使用> = 0
p1 -结尾的文件位置使用> = P1
g -图形上下文
x -起始位置> = 0
y的启动位置> = 0
drawUnselectedText(java.awt.Graphics, int, int, int, int),
drawSelectedText(java.awt.Graphics, int, int, int, int)
protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException
g -图形上下文
x -启动X坐标> = 0
y -起始Y坐标> = 0
p0在模型> = 0的起始位置
p1的结束位置在模型> = P0
BadLocationException -如果范围是无效的
protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException
g -图形上下文
x -启动X坐标> = 0
y -起始Y坐标> = 0
p0在模型> = 0的起始位置
p1的结束位置在模型> = P0
BadLocationException -如果范围是无效的
protected final Segment getLineBuffer()
protected int calculateBreakPosition(int p0,
int p1)
protected void loadChildren(ViewFactory f)
setParent方法。子类可以重新实现这个初始化以不同的方式,他们的孩子的观点。默认实现为每个子元素创建子视图。
loadChildren 方法重写,继承类
CompositeView
f -看厂
CompositeView.setParent(javax.swing.text.View)
public float nextTabStop(float x,
int tabOffset)
nextTabStop 接口
TabExpander
x -当前位置> = 0
tabOffset -文本流标签出现在> = 0的位置。
public void paint(Graphics g, Shape a)
paint 方法重写,继承类
BoxView
g -绘制表面使用
a -分配区域进行渲染
View.paint(java.awt.Graphics, java.awt.Shape)
public void setSize(float width,
float height)
public float getPreferredSpan(int axis)
getPreferredSpan 方法重写,继承类
BoxView
axis -可能是view.x_axis或view.y_axis
View.getPreferredSpan(int)
public float getMinimumSpan(int axis)
getMinimumSpan 方法重写,继承类
BoxView
axis -可能是view.x_axis或view.y_axis
View.getMinimumSpan(int)
public float getMaximumSpan(int axis)
getMaximumSpan 方法重写,继承类
BoxView
axis -可能是view.x_axis或view.y_axis
View.getMaximumSpan(int)
public void insertUpdate(DocumentEvent e, Shape a, ViewFactory f)
insertUpdate 方法重写,继承类
View
e -从相关文档的变更信息
a -视图的当前配置
f -工厂用重建如果视图有孩子
View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
public void removeUpdate(DocumentEvent e, Shape a, ViewFactory f)
removeUpdate 方法重写,继承类
View
e -从相关文档的变更信息
a -视图的当前配置
f -工厂用重建如果视图有孩子
View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
changedUpdate 方法重写,继承类
View
e -从相关文档的变更信息
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.