public class DefaultAttributeSet extends Object implements AttributeSet
Modifier and Type | Field and Description |
---|---|
protected Map<Attribute<?>,List<? extends AttributeValue>> |
attributes |
protected AttributeSet |
parent |
Constructor and Description |
---|
DefaultAttributeSet()
Creates a default attribute set which does not have a parent.
|
DefaultAttributeSet(AttributeSet _parent)
Creates a default attribute set with the given parent.
|
Modifier and Type | Method and Description |
---|---|
<T extends AttributeValue> |
addAttribute(Attribute<T> key,
T value) |
<T extends AttributeValue> |
addAttribute(AttributeMapper.Mapping<T> mapping) |
boolean |
contains(Attribute<?> key,
AttributeValue value,
boolean resolveInherited)
Test if the attribute is set and has the specified value.
|
boolean |
containsKey(Attribute<?> key,
boolean resolveInherited)
Test if the attribute for a given key is defined.
|
<T extends AttributeValue> |
getAttribute(Attribute<T> key,
boolean resolveInherited)
Returns the attribute values for a given attribute.
|
Iterator<Attribute<?>> |
getAttributeKeys(boolean resolveInherited)
Returns an iteration of attribute keys defined in the attribute set.
|
AttributeSet |
getParent()
Get the parent attribute set of this set.
|
boolean |
isEmpty()
Test if there are any attributes defined in this set.
|
boolean |
isInherited(Attribute<?> key)
Test if a given attribute is inherited from a parent attribute set.
|
DefaultAttributeSet |
setParent(AttributeSet _parent)
Set the parent attribute set used to resolve inherited attributes.
|
String |
toString() |
protected AttributeSet parent
protected Map<Attribute<?>,List<? extends AttributeValue>> attributes
public DefaultAttributeSet()
public DefaultAttributeSet(AttributeSet _parent)
_parent
- Parent of the new attribute set.public boolean containsKey(Attribute<?> key, boolean resolveInherited)
AttributeSet
containsKey
in interface AttributeSet
key
- Attribute key which is tested.resolveInherited
- true
if the key is searched in the parent sets too,
false
if inherited attributes should be ignored.public boolean contains(Attribute<?> key, AttributeValue value, boolean resolveInherited)
AttributeSet
contains
in interface AttributeSet
public <T extends AttributeValue> List<T> getAttribute(Attribute<T> key, boolean resolveInherited)
AttributeSet
getAttribute
in interface AttributeSet
key
- Attribute key for which the attribute is requested.resolveInherited
- true
if the attribute is searched in the parent sets too,
false
if inherited attributes should be ignored.public boolean isInherited(Attribute<?> key) throws AttributeNotSetException
AttributeSet
isInherited
in interface AttributeSet
true
if the attribute is inherited, false
if the attribute
is contained in this set.AttributeNotSetException
- if the attribute is not defined in this set or a parent set.public Iterator<Attribute<?>> getAttributeKeys(boolean resolveInherited)
AttributeSet
getAttributeKeys
in interface AttributeSet
resolveInherited
- true
if inherited attribute keys are iterated too,
false
if inherited attributes should be ignored.Attributes
.public DefaultAttributeSet setParent(AttributeSet _parent)
public AttributeSet getParent()
AttributeSet
null
if this is a root set.getParent
in interface AttributeSet
public <T extends AttributeValue> void addAttribute(AttributeMapper.Mapping<T> mapping)
public <T extends AttributeValue> void addAttribute(Attribute<T> key, T value)
public boolean isEmpty()
AttributeSet
isEmpty
in interface AttributeSet
Copyright © 2001-2013 the JGloss developers. All Rights Reserved.