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