| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public class StyleContext.NamedStyle extends Object implements Style, Serializable
A collection of attributes, typically used to represent character and paragraph styles. This is an implementation of MutableAttributeSet that can be observed if desired. These styles will take advantage of immutability while the sets are small enough, and may be substantially more efficient than something like SimpleAttributeSet.
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 JavaBeansTM
has been added to the java.beans
package.
Please see {@link java.beans.XMLEncoder}.
Field Summary | |
---|---|
protected transient 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. |
Constructor Summary | |
---|---|
Creates a new named style, with a null name and parent. |
|
StyleContext.NamedStyle(String name, Style parent) Creates a new named style. |
|
StyleContext.NamedStyle(Style parent) Creates a new named style. |
Method Summary | |
---|---|
void |
addAttribute(Object name, Object value) Adds an attribute. |
void |
addAttributes(AttributeSet attr) Adds a set of attributes to the element. |
void |
Adds a change listener. |
boolean |
containsAttribute(Object name, Object value) Checks whether a given attribute name/value is defined. |
boolean |
containsAttributes(AttributeSet attrs) Checks whether the element contains all the attributes. |
AttributeSet |
Copies a set of attributes. |
protected void |
Notifies all listeners that have registered interest for notification on this event type. |
Object |
getAttribute(Object attrName) Gets the value of an attribute. |
int |
Gets the number of attributes that are defined. |
Enumeration |
Gets the names of all attributes. |
ChangeListener[] |
Returns an array of all the ChangeListener s added
to this NamedStyle with addChangeListener().
|
EventListener[] |
getListeners(Class listenerType) 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 |
Gets attributes from the parent. |
boolean |
Checks whether a given attribute is defined. |
boolean |
isEqual(AttributeSet attr) Checks whether two attribute sets are equal. |
void |
removeAttribute(Object name) Removes an attribute from the set. |
void |
removeAttributes(AttributeSet attrs) Removes a set of attributes for the element. |
void |
removeAttributes(Enumeration names) Removes a set of attributes for the element. |
void |
Removes a change listener. |
void |
Changes the name of the style. |
void |
setResolveParent(AttributeSet parent) Sets the resolving parent. |
String |
toString() Converts the style to a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient ChangeEvent changeEvent
protected EventListenerList listenerList
Constructor Detail |
---|
public StyleContext.NamedStyle()
public StyleContext.NamedStyle(String name, Style parent)
name
- the style name, null for unnamedparent
- the parent style, null if nonepublic StyleContext.NamedStyle(Style parent)
parent
- the parent style, null if noneMethod Detail |
---|
public void addAttribute(Object name, Object value)
name
- the non-null attribute namevalue
- the attribute valuepublic void addAttributes(AttributeSet attr)
attr
- the attributes to addpublic void addChangeListener(ChangeListener l)
l
- the change listenerpublic boolean containsAttribute(Object name, Object value)
name
- the non-null attribute namevalue
- the attribute valuepublic boolean containsAttributes(AttributeSet attrs)
attrs
- the attributes to checkpublic AttributeSet copyAttributes()
protected void fireStateChanged()
public Object getAttribute(Object attrName)
attrName
- the non-null attribute namepublic int getAttributeCount()
public Enumeration getAttributeNames()
public ChangeListener[] getChangeListeners()
ChangeListener
s added
to this NamedStyle with addChangeListener().
ChangeListener
s added or an empty
array if no listeners have been addedpublic EventListener[] getListeners(Class listenerType)
listenerType
public String getName()
public AttributeSet getResolveParent()
public boolean isDefined(Object attrName)
attrName
- the non-null attribute namepublic boolean isEqual(AttributeSet attr)
attr
- the attribute set to check againstpublic void removeAttribute(Object name)
name
- the non-null attribute namepublic void removeAttributes(AttributeSet attrs)
attrs
- the attributespublic void removeAttributes(Enumeration names)
names
- the attribute namespublic void removeChangeListener(ChangeListener l)
l
- the change listenerpublic void setName(String name)
name
- the new namepublic void setResolveParent(AttributeSet parent)
parent
- the parent, null if nonepublic String toString()
toString
in class Object
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |