public class BlockView extends BoxView
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| Modifier and Type | Method and Description |
|---|---|
protected SizeRequirements |
calculateMajorAxisRequirements(int axis, SizeRequirements r)
沿长轴计算块的要求(即
|
protected SizeRequirements |
calculateMinorAxisRequirements(int axis, SizeRequirements r)
沿着短轴计算块的要求(即
|
void |
changedUpdate(DocumentEvent changes, Shape a, ViewFactory f)
在该视图负责的位置向文档发出属性更改的通知。
|
float |
getAlignment(int axis)
获得对齐。
|
AttributeSet |
getAttributes()
获取渲染时要使用的属性。
|
float |
getMaximumSpan(int axis)
确定沿着轴的该视图的最大跨度。
|
float |
getMinimumSpan(int axis)
确定此视图沿轴的最小跨度。
|
float |
getPreferredSpan(int axis)
确定沿着轴的此视图的首选跨度。
|
int |
getResizeWeight(int axis)
获得调整重量。
|
protected StyleSheet |
getStyleSheet() |
protected void |
layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans)
执行框的短轴的布局(即
|
void |
paint(Graphics g, Shape allocation)
渲染使用给定的渲染表面和该表面上的区域。
|
void |
setParent(View parent)
建立此视图的父视图。
|
protected void |
setPropertiesFromAttributes()
更新来自属性的任何缓存值。
|
baselineLayout, baselineRequirements, childAllocation, flipEastAndWestAtEnds, forwardUpdate, getAxis, getChildAllocation, getHeight, getOffset, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layout, layoutChanged, layoutMajorAxis, modelToView, paintChild, preferenceChanged, replace, setAxis, setSize, viewToModelgetBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, getViewIndexAtPosition, loadChildren, modelToView, setInsets, setParagraphInsetsappend, breakView, createFragment, forwardUpdateToView, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, insertUpdate, isVisible, modelToView, remove, removeAll, removeUpdate, updateChildren, updateLayout, viewToModelpublic BlockView(Element elem, int axis)
elem - 为其创建视图的元素
axis - View.X_AXIS或View.Y_AXIS
public void setParent(View parent)
这实现为转发到超类,以及调用setPropertiesFromAttributes()方法从css属性设置段属性。 此时通话是为了确保通过父母视图属性向上解决的能力。
setParent在
CompositeView
parent - 新的父项,如果视图从之前添加到的父项中删除,则为null
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r)
calculateMajorAxisRequirements在
BoxView
axis - 正在研究的轴
r - SizeRequirements对象;
如果null将创建一个
SizeRequirements对象
SizeRequirements
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
calculateMinorAxisRequirements在
BoxView
axis - 正在研究的轴
r - SizeRequirements对象;
如果null将创建一个
SizeRequirements对象
SizeRequirements
protected void layoutMinorAxis(int targetSpan,
int axis,
int[] offsets,
int[] spans)
layoutMinorAxis在类
BoxView
targetSpan - 给予视图的总跨度,用于布局孩子。
axis - 轴被
axis
offsets - 每个子视图的视图起源的偏移量;
这是一个返回值并通过执行此方法填写
spans - 每个子视图的跨度;
这是一个返回值并通过执行此方法填写
public void paint(Graphics g, Shape allocation)
paint在
BoxView
g - 要使用的渲染表面
allocation - 要分配的区域
View.paint(java.awt.Graphics, java.awt.Shape)
public AttributeSet getAttributes()
getAttributes在
View
public int getResizeWeight(int axis)
getResizeWeight在类
BoxView
axis - 可以是X_AXIS或Y_AXIS
IllegalArgumentException - 针对无效轴
public float getAlignment(int axis)
getAlignment在
BoxView
axis - 可以是X_AXIS或Y_AXIS
public void changedUpdate(DocumentEvent changes, Shape a, ViewFactory f)
View
updateChildren被调用,如果该视图负责的元素有任何更改。 如果此视图具有表示子元素的子视图,则此方法应执行必要的任何操作,以确保子视图正确表示模型。 forwardUpdate叫到的DocumentEvent转发给相应的子视图。 updateLayout被称为给视图一个机会来修复它的布局,重新安排布局,或什么都不做。 changedUpdate在
View
changes - 相关文件的更改信息
a - 视图的当前分配
f - 工厂使用重建如果视图有孩子
View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
public float getPreferredSpan(int axis)
getPreferredSpan在
BoxView
axis - 可能是
View.X_AXIS或
View.Y_AXIS
IllegalArgumentException - 无效轴类型
View.getPreferredSpan(int)
public float getMinimumSpan(int axis)
getMinimumSpan在
BoxView
axis - 可能是
View.X_AXIS或
View.Y_AXIS
IllegalArgumentException - 对于无效的轴类型
View.getPreferredSpan(int)
public float getMaximumSpan(int axis)
getMaximumSpan在
BoxView
axis - 可能是
View.X_AXIS或
View.Y_AXIS
IllegalArgumentException - 对于无效的轴类型
View.getPreferredSpan(int)
protected void setPropertiesFromAttributes()
protected StyleSheet getStyleSheet()
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.