java.lang.Object
javax.swing.text.AbstractDocument.AbstractElement
- 所有已实现的接口:
Serializable,AttributeSet,Element,MutableAttributeSet,TreeNode
- 封闭类:
AbstractDocument
public abstract class AbstractDocument.AbstractElement extends Object implements Element , MutableAttributeSet , Serializable , TreeNode
实现元素的抽象部分。默认情况下,元素通过具有表示元素当前属性集的不可变部分的字段来支持属性。元素本身实现了 MutableAttributeSet,可用于通过获取新的不可变集来修改集。不可变集由与文档关联的 AttributeContext 提供。
Warning: 此类的序列化对象将与未来的 Swing 版本不兼容。当前的序列化支持适用于运行相同版本 Swing 的应用程序之间的短期存储或 RMI。从 1.4 开始,对所有 JavaBeans 的长期存储的支持已添加到 java.beans 包中。请参阅 XMLEncoder 。
-
内部类总结
在接口 javax.swing.text.AttributeSet 中声明的嵌套类/接口
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute -
字段摘要
在接口 javax.swing.text.AttributeSet 中声明的字段
NameAttribute, ResolveAttribute -
构造方法总结
构造方法 -
方法总结
修饰符和类型方法描述voidaddAttribute(Object name, Object value) 向元素添加属性。voidaddAttributes(AttributeSet attr) 向元素添加一组属性。abstract Enumeration<TreeNode>children()将接收器的子级作为Enumeration返回。booleancontainsAttribute(Object name, Object value) 检查是否定义了给定的属性名称/值。booleancontainsAttributes(AttributeSet attrs) 检查元素是否包含所有属性。复制一组属性。voiddump(PrintStream psOut, int indentAmount) 转储元素层次结构的调试表示。abstract boolean如果接收者允许子级,则返回 true。getAttribute(Object attrName) 获取属性的值。int获取已定义的属性数。Enumeration<?>获取所有属性的名称。获取元素的属性。getChildAt(int childIndex) 返回索引childIndex处的子节点TreeNode。int返回TreeNode的接收器包含的子项数。检索基础模型。abstract ElementgetElement(int index) 获取子元素。abstract int获取元素的子元素数。abstract intgetElementIndex(int offset) 获取最接近给定模型偏移量的子元素索引。abstract int获取元素模型中的结束偏移量。int返回接收者孩子中node的索引。getName()获取元素的名称。返回接收器的父节点TreeNode。获取元素的父级。获取解析父对象。abstract int获取元素在模型中的起始偏移量。boolean检查给定的属性是否已定义。booleanisEqual(AttributeSet attr) 检查两个属性集是否相等。abstract booleanisLeaf()检查元素是否是叶子。voidremoveAttribute(Object name) 从集合中移除一个属性。voidremoveAttributes(Enumeration<?> names) 删除元素的一组属性。voidremoveAttributes(AttributeSet attrs) 删除元素的一组属性。voidsetResolveParent(AttributeSet parent) 设置解析父级。
-
构造方法详细信息
-
AbstractElement
创建一个新的抽象元素。- 参数:
parent- 父元素a- 元素的属性- 自从:
- 1.4
-
-
方法详情
-
dump
转储元素层次结构的调试表示。- 参数:
psOut- 输出流indentAmount- 缩进级别 >= 0
-
getAttributeCount
public int getAttributeCount()获取已定义的属性数。- 指定者:
getAttributeCount在接口AttributeSet中- 返回:
- 属性数 >= 0
- 参见:
-
isDefined
检查给定的属性是否已定义。- 指定者:
isDefined在接口AttributeSet中- 参数:
attrName- 非空属性名称- 返回:
- 如果定义了属性,则为真
- 参见:
-
isEqual
检查两个属性集是否相等。- 指定者:
isEqual在接口AttributeSet中- 参数:
attr- 要检查的属性集- 返回:
- 如果相同则为真
- 参见:
-
copyAttributes
复制一组属性。- 指定者:
copyAttributes在接口AttributeSet中- 返回:
- 副本
- 参见:
-
getAttribute
获取属性的值。- 指定者:
getAttribute在接口AttributeSet中- 参数:
attrName- 非空属性名称- 返回:
- 属性值
- 参见:
-
getAttributeNames
获取所有属性的名称。- 指定者:
getAttributeNames在接口AttributeSet中- 返回:
- 作为枚举的属性名称
- 参见:
-
containsAttribute
检查是否定义了给定的属性名称/值。- 指定者:
containsAttribute在接口AttributeSet中- 参数:
name- 非空属性名称value- 属性值- 返回:
- 如果定义了名称/值,则为真
- 参见:
-
containsAttributes
检查元素是否包含所有属性。- 指定者:
containsAttributes在接口AttributeSet中- 参数:
attrs- 要检查的属性- 返回:
- 如果元素包含所有属性,则为真
- 参见:
-
getResolveParent
获取解析父对象。如果没有被重写,解析父元素默认为父元素。- 指定者:
getResolveParent在接口AttributeSet中- 返回:
-
来自父级的属性,
null如果没有 - 参见:
-
addAttribute
向元素添加属性。- 指定者:
addAttribute在接口MutableAttributeSet中- 参数:
name- 非空属性名称value- 属性值- 参见:
-
addAttributes
向元素添加一组属性。- 指定者:
addAttributes在接口MutableAttributeSet中- 参数:
attr- 要添加的属性- 参见:
-
removeAttribute
从集合中移除一个属性。- 指定者:
removeAttribute在接口MutableAttributeSet中- 参数:
name- 非空属性名称- 参见:
-
removeAttributes
删除元素的一组属性。- 指定者:
removeAttributes在接口MutableAttributeSet中- 参数:
names- 属性名称- 参见:
-
removeAttributes
删除元素的一组属性。- 指定者:
removeAttributes在接口MutableAttributeSet中- 参数:
attrs- 属性- 参见:
-
setResolveParent
设置解析父级。- 指定者:
setResolveParent在接口MutableAttributeSet中- 参数:
parent- 父级,如果没有则为 null- 参见:
-
getDocument
检索基础模型。- 指定者:
getDocument在接口Element中- 返回:
- 该模型
-
getParentElement
获取元素的父级。- 指定者:
getParentElement在接口Element中- 返回:
- 父级
-
getAttributes
获取元素的属性。- 指定者:
getAttributes在接口Element中- 返回:
- 属性集
-
getName
获取元素的名称。 -
getStartOffset
public abstract int getStartOffset()获取元素在模型中的起始偏移量。- 指定者:
getStartOffset在接口Element中- 返回:
- offset >= 0
- 参见:
-
getEndOffset
public abstract int getEndOffset()获取元素模型中的结束偏移量。- 指定者:
getEndOffset在接口Element中- 返回:
- offset >= 0
- 参见:
-
getElement
获取子元素。- 指定者:
getElement在接口Element中- 参数:
index- 子索引,>= 0 && < getElementCount()- 返回:
- 子元素
-
getElementCount
public abstract int getElementCount()获取元素的子元素数。- 指定者:
getElementCount在接口Element中- 返回:
- 子级的数量 >= 0
-
getElementIndex
public abstract int getElementIndex(int offset) 获取最接近给定模型偏移量的子元素索引。- 指定者:
getElementIndex在接口Element中- 参数:
offset- 偏移量 >= 0- 返回:
- 元素索引 >= 0
-
isLeaf
public abstract boolean isLeaf()检查元素是否是叶子。 -
getChildAt
返回索引childIndex处的子节点TreeNode。- 指定者:
getChildAt在接口TreeNode中- 参数:
childIndex- 孩子的索引- 返回:
- 给定索引处的子节点
-
getChildCount
public int getChildCount()返回TreeNode的接收器包含的子项数。- 指定者:
getChildCount在接口TreeNode中- 返回:
TreeNodews的接收器包含的孩子数量
-
getParent
返回接收器的父节点TreeNode。 -
getIndex
返回接收者孩子中node的索引。如果接收器不包含node,将返回 -1。 -
getAllowsChildren
public abstract boolean getAllowsChildren()如果接收者允许子级,则返回 true。- 指定者:
getAllowsChildren在接口TreeNode中- 返回:
- 如果接收者允许子级,则为 true,否则为 false
-
children
将接收器的子级作为Enumeration返回。
-