|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpicedt.graphic.model.PicAttributeSet
public class PicAttributeSet
a class that stores non-default graphical attributes (e.g. "fill", "stroke", etc... ) in a hashtable. If a key is not found in the map, we look up the resolving parent.
PicAttributeName
,
StyleConstants
Field Summary | |
---|---|
static jpicedt.graphic.model.DefaultAttributeSet |
DEFAULT_SET
an immutable attribute set that serves as the resolving parent if no resolving parent is explicitly set |
protected HashMap<PicAttributeName,Object> |
map
a map holding name/value pairs |
protected PicAttributeSet |
parent
if non-null, used as the resolving parent when name is not found in current set |
Constructor Summary | |
---|---|
PicAttributeSet()
Create a new PicAttributeSet with DEFAULT_SET as the resolving parent. |
|
PicAttributeSet(PicAttributeSet src)
cloning constructor |
Method Summary | ||
---|---|---|
PicAttributeSet |
copyAttributes()
return a copy of this PicAttributeSet with the same resolving parent as the source, and which is guaranteed not to change over time. |
|
|
getAttribute(PicAttributeName<T> name)
Returns the attribute with the given name, possibly resolving to parent if "name" is not defined in this set. |
|
int |
getAttributeCount()
Returns the number of attributes contained in this set ; this doesn't include the attributes of the resolving parent. |
|
Iterator<PicAttributeName> |
getAttributeNames()
Returns an iterator over the names of the attributes in this attribute set ; this doesn't iterate over the keys of the resolving parent. |
|
PicAttributeSet |
getResolveParent()
Returns the resolving parent, or DEFAULT_SET if it's null. |
|
|
setAttribute(PicAttributeName<T> name,
T value)
Add a new name/value pair to the set if it's present nor in the set, nor in the resolving parent, otherwise modify the value for the given name. |
|
void |
setAttributes(PicAttributeSet src)
Sets several name/value pairs at a time from the given set. |
|
void |
setResolveParent(PicAttributeSet parent)
set the resolving parent. |
|
String |
toString()
Returns a text representation of this attribute set, for debugging purpose |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final jpicedt.graphic.model.DefaultAttributeSet DEFAULT_SET
protected HashMap<PicAttributeName,Object> map
protected PicAttributeSet parent
Constructor Detail |
---|
public PicAttributeSet()
StyleConstants
public PicAttributeSet(PicAttributeSet src)
src
- the attribute set to be cloned ; set the resolving parent to the resolving parent
of the source.Method Detail |
---|
public PicAttributeSet getResolveParent()
public void setResolveParent(PicAttributeSet parent)
parent
- if null, set the parent to DEFAULT_SET.public PicAttributeSet copyAttributes()
public <T> T getAttribute(PicAttributeName<T> name)
public <T> void setAttribute(PicAttributeName<T> name, T value)
name
- attribute namevalue
- attribute valuepublic void setAttributes(PicAttributeSet src)
public int getAttributeCount()
public Iterator<PicAttributeName> getAttributeNames()
public String toString()
toString
in class Object
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |