public class StyleContext.NamedStyle extends Objectimplements Style , Serializable
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.
AttributeSet.CharacterAttribute , AttributeSet.ColorAttribute , AttributeSet.FontAttribute , AttributeSet.ParagraphAttribute | Modifier and Type | Field and Description |
|---|---|
protected ChangeEvent |
changeEvent
Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property.
|
protected EventListenerList |
listenerList
The change listeners for the model.
|
NameAttribute, ResolveAttribute| Constructor and Description |
|---|
NamedStyle()
Creates a new named style, with a null name and parent.
|
NamedStyle(String
Creates a new named style.
|
NamedStyle(Style
Creates a new named style.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(Object
Adds an attribute.
|
void |
addAttributes(AttributeSet
Adds a set of attributes to the element.
|
void |
addChangeListener(ChangeListener
Adds a change listener.
|
boolean |
containsAttribute(Object
Checks whether a given attribute name/value is defined.
|
boolean |
containsAttributes(AttributeSet
Checks whether the element contains all the attributes.
|
AttributeSet |
copyAttributes()
Copies a set of attributes.
|
protected void |
fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type.
|
Object |
getAttribute(Object
Gets the value of an attribute.
|
int |
getAttributeCount()
Gets the number of attributes that are defined.
|
Enumeration |
getAttributeNames()
Gets the names of all attributes.
|
ChangeListener |
getChangeListeners()
Returns an array of all the
ChangeListeners added to this NamedStyle with addChangeListener().
|
<T extends EventListener |
getListeners(Class
Return an array of all the listeners of the given type that were added to this model.
|
String |
getName()
Fetches the name of the style.
|
AttributeSet |
getResolveParent()
Gets attributes from the parent.
|
boolean |
isDefined(Object
Checks whether a given attribute is defined.
|
boolean |
isEqual(AttributeSet
Checks whether two attribute sets are equal.
|
void |
removeAttribute(Object
Removes an attribute from the set.
|
void |
removeAttributes(AttributeSet
Removes a set of attributes for the element.
|
void |
removeAttributes(Enumeration
Removes a set of attributes for the element.
|
void |
removeChangeListener(ChangeListener
Removes a change listener.
|
void |
setName(String
Changes the name of the style.
|
void |
setResolveParent(AttributeSet
Sets the resolving parent.
|
String |
toString()
Converts the style to a string.
|
protected EventListenerListlistenerList
protected transient ChangeEventchangeEvent
public NamedStyle(Stringname, Style parent)
name - the style name, null for unnamed
parent - the parent style, null if none
public NamedStyle(Styleparent)
parent - the parent style, null if none
public NamedStyle()
public StringtoString()
public StringgetName()
public void setName(Stringname)
name - the new name
public void addChangeListener(ChangeListenerl)
addChangeListener in interface
Style
l - the change listener
public void removeChangeListener(ChangeListenerl)
removeChangeListener in interface
Style
l - the change listener
public ChangeListener[] getChangeListeners()
ChangeListeners added to this NamedStyle with addChangeListener().
ChangeListeners added or an empty array if no listeners have been added
protected void fireStateChanged()
EventListenerList
public <T extends EventListener> T[] getListeners(Class <T> listenerType)
public int getAttributeCount()
getAttributeCount in interface
AttributeSet
AttributeSet.getAttributeCount()
public boolean isDefined(ObjectattrName)
isDefined in interface
AttributeSet
attrName - the non-null attribute name
AttributeSet.isDefined(java.lang.Object)
public boolean isEqual(AttributeSetattr)
isEqual in interface
AttributeSet
attr - the attribute set to check against
AttributeSet.isEqual(javax.swing.text.AttributeSet)
public AttributeSetcopyAttributes()
copyAttributes in interface
AttributeSet
AttributeSet.copyAttributes()
public ObjectgetAttribute(Object attrName)
getAttribute in interface
AttributeSet
attrName - the non-null attribute name
AttributeSet.getAttribute(java.lang.Object)
public Enumeration<?> getAttributeNames()
getAttributeNames in interface
AttributeSet
AttributeSet.getAttributeNames()
public boolean containsAttribute(Objectname, Object value)
containsAttribute in interface
AttributeSet
name - the non-null attribute name
value - the attribute value
AttributeSet.containsAttribute(java.lang.Object, java.lang.Object)
public boolean containsAttributes(AttributeSetattrs)
containsAttributes in interface
AttributeSet
attrs - the attributes to check
AttributeSet.containsAttributes(javax.swing.text.AttributeSet)
public AttributeSetgetResolveParent()
getResolveParent in interface
AttributeSet
AttributeSet.getResolveParent()
public void addAttribute(Objectname, Object value)
addAttribute in interface
MutableAttributeSet
name - the non-null attribute name
value - the attribute value
MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)
public void addAttributes(AttributeSetattr)
addAttributes in interface
MutableAttributeSet
attr - the attributes to add
MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)
public void removeAttribute(Objectname)
removeAttribute in interface
MutableAttributeSet
name - the non-null attribute name
MutableAttributeSet.removeAttribute(java.lang.Object)
public void removeAttributes(Enumeration<?> names)
removeAttributes in interface
MutableAttributeSet
names - the attribute names
MutableAttributeSet.removeAttributes(java.util.Enumeration<?>)
public void removeAttributes(AttributeSetattrs)
removeAttributes in interface
MutableAttributeSet
attrs - the attributes
MutableAttributeSet.removeAttributes(java.util.Enumeration<?>)
public void setResolveParent(AttributeSetparent)
setResolveParent in interface
MutableAttributeSet
parent - the parent, null if none
MutableAttributeSet.setResolveParent(javax.swing.text.AttributeSet)