public static interface AbstractDocument.AttributeContext
一个接口,它用于允许 MutableAttributeSet 的实现使用可插入属性压缩技术。可以使用属性集的每个变化将以前的 AttributeSet 实例与另一个实例交换,保留 AttributeSet 保持不可变的可能性。StyleContext 类提供了一个实现。 此类提供的 Element 实现使用此接口来提供其 MutableAttributeSet 实现,所以可采用不同的 AttributeSet 压缩技术。要返回负责实现所需压缩技术的对象,则应该实现 getAttributeContext 方法。
StyleContext
| 方法摘要 | |
|---|---|
AttributeSet |
addAttribute(AttributeSet old, Object name, Object value) 向给定属性集中添加一个属性,并返回新的有代表性的属性集。 |
AttributeSet |
addAttributes(AttributeSet old, AttributeSet attr) 向元素添加一组属性。 |
AttributeSet |
getEmptySet() 获取一个空的 AttributeSet。 |
void |
reclaim(AttributeSet a) 回收某个属性集。 |
AttributeSet |
removeAttribute(AttributeSet old, Object name) 从属性集中移除某个属性。 |
AttributeSet |
removeAttributes(AttributeSet old, AttributeSet attrs) 移除元素的一组属性。 |
AttributeSet |
removeAttributes(AttributeSet old, Enumeration<?> names) 移除元素的一组属性。 |
| 方法详细信息 |
|---|
AttributeSet addAttribute(AttributeSet old, Object name, Object value)
old - 旧的属性集
name - 非 null 的属性名
value - 属性值
MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)
AttributeSet addAttributes(AttributeSet old, AttributeSet attr)
old - 旧的属性集
attr - 要添加的属性
MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)
AttributeSet removeAttribute(AttributeSet old, Object name)
old - 旧的属性集
name - 非 null 的属性名
MutableAttributeSet.removeAttribute(java.lang.Object)
AttributeSet removeAttributes(AttributeSet old, Enumeration<?> names)
old - 旧的属性集
names - 属性名
MutableAttributeSet.removeAttributes(java.util.Enumeration
)
AttributeSet removeAttributes(AttributeSet old, AttributeSet attrs)
old - 旧的属性集
attrs - 属性
MutableAttributeSet.removeAttributes(java.util.Enumeration
)
AttributeSet getEmptySet()
void reclaim(AttributeSet a)
a - 要回收的属性集