|
Java™ Platform Standard Ed. 6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.text.StyleContext.NamedStyle
public class StyleContext.NamedStyle
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 XMLEncoder
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface javax.swing.text.AttributeSet |
---|
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute |
Field Summary | |
---|---|
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. |
Fields inherited from interface javax.swing.text.AttributeSet |
---|
NameAttribute, ResolveAttribute |
Constructor Summary | |
---|---|
StyleContext.NamedStyle()
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 |
addChangeListener(ChangeListener l)
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 |
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 attrName)
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 ChangeListener s added
to this NamedStyle with addChangeListener(). |
|
|
getListeners(Class<T> 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 |
getResolveParent()
Gets attributes from the parent. |
|
boolean |
isDefined(Object attrName)
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 |
removeChangeListener(ChangeListener l)
Removes a change listener. |
|
void |
setName(String name)
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, wait, wait, wait |
Field Detail |
---|
protected EventListenerList listenerList
protected transient ChangeEvent changeEvent
Constructor Detail |
---|
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 nonepublic StyleContext.NamedStyle()
Method Detail |
---|
public String toString()
toString
in class Object
public String getName()
getName
in interface Style
public void setName(String name)
name
- the new namepublic void addChangeListener(ChangeListener l)
addChangeListener
in interface Style
l
- the change listenerpublic void removeChangeListener(ChangeListener l)
removeChangeListener
in interface Style
l
- the change listenerpublic ChangeListener[] getChangeListeners()
ChangeListener
s added
to this NamedStyle with addChangeListener().
ChangeListener
s added or an empty
array if no listeners have been addedprotected void fireStateChanged()
EventListenerList
public <T extends EventListener> T[] getListeners(Class<T> listenerType)
public int getAttributeCount()
getAttributeCount
in interface AttributeSet
AttributeSet.getAttributeCount()
public boolean isDefined(Object attrName)
isDefined
in interface AttributeSet
attrName
- the non-null attribute name
AttributeSet.isDefined(java.lang.Object)
public boolean isEqual(AttributeSet attr)
isEqual
in interface AttributeSet
attr
- the attribute set to check against
AttributeSet.isEqual(javax.swing.text.AttributeSet)
public AttributeSet copyAttributes()
copyAttributes
in interface AttributeSet
AttributeSet.copyAttributes()
public Object getAttribute(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(Object name, Object value)
containsAttribute
in interface AttributeSet
name
- the non-null attribute namevalue
- the attribute value
AttributeSet.containsAttribute(java.lang.Object, java.lang.Object)
public boolean containsAttributes(AttributeSet attrs)
containsAttributes
in interface AttributeSet
attrs
- the attributes to check
AttributeSet.containsAttributes(javax.swing.text.AttributeSet)
public AttributeSet getResolveParent()
getResolveParent
in interface AttributeSet
AttributeSet.getResolveParent()
public void addAttribute(Object name, Object value)
addAttribute
in interface MutableAttributeSet
name
- the non-null attribute namevalue
- the attribute valueMutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)
public void addAttributes(AttributeSet attr)
addAttributes
in interface MutableAttributeSet
attr
- the attributes to addMutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)
public void removeAttribute(Object name)
removeAttribute
in interface MutableAttributeSet
name
- the non-null attribute nameMutableAttributeSet.removeAttribute(java.lang.Object)
public void removeAttributes(Enumeration<?> names)
removeAttributes
in interface MutableAttributeSet
names
- the attribute namesMutableAttributeSet.removeAttributes(java.util.Enumeration>)
public void removeAttributes(AttributeSet attrs)
removeAttributes
in interface MutableAttributeSet
attrs
- the attributesMutableAttributeSet.removeAttributes(java.util.Enumeration>)
public void setResolveParent(AttributeSet parent)
setResolveParent
in interface MutableAttributeSet
parent
- the parent, null if noneMutableAttributeSet.setResolveParent(javax.swing.text.AttributeSet)
|
Java™ Platform Standard Ed. 6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1993, 2015, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.