All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.swing.text.StyleContext.NamedStyle

java.lang.Object
    |
    +----java.awt.swing.text.StyleContext.NamedStyle

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.


Variable Index

 o changeEvent
Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property.
 o listenerList
The change listeners for the model.

Constructor Index

 o StyleContext.NamedStyle(StyleContext)
 o StyleContext.NamedStyle(StyleContext, String, Style)
Creates a new named style.
 o StyleContext.NamedStyle(StyleContext, Style)
Creates a new named style.

Method Index

 o addAttribute(String, Object)
Adds an attribute.
 o addAttributes(AttributeSet)
Adds a set of attributes to the element.
 o addChangeListener(ChangeListener)
Adds a change listener.
 o containsAttribute(String, Object)
Checks whether a given attribute name/value is defined.
 o containsAttributes(AttributeSet)
Checks whether the element contains all the attributes.
 o copyAttributes()
Copies a set of attributes.
 o fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type.
 o getAttribute(String)
Gets the value of an attribute.
 o getAttributeCount()
Gets the number of attributes that are defined.
 o getAttributeNames()
Gets the names of all attributes.
 o getName()
Fetches the name of the style.
 o getResolveParent()
If not overriden, the resolving parent defaults to the parent element.
 o isDefined(String)
Checks whether a given attribute is defined.
 o isEmpty()
Checks whether any attributes have been defined.
 o isEqual(AttributeSet)
Checks whether two attribute sets are equal.
 o removeAttribute(String)
Removes an attribute from the set.
 o removeAttributes(AttributeSet)
Removes a set of attributes for the element.
 o removeAttributes(Enumeration)
Removes a set of attributes for the element.
 o removeChangeListener(ChangeListener)
Removes a change listener.
 o setName(String)
Changes the name of the style.
 o setResolveParent(MutableAttributeSet)
Sets the resolving parent.
 o toString()
Converts the style to a string.

Variables

 o listenerList
protected EventListenerList listenerList
The change listeners for the model.

 o changeEvent
protected ChangeEvent changeEvent
Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property. The source of events generated here is always "this".

Constructors

 o StyleContext.NamedStyle
public StyleContext.NamedStyle(StyleContext this$0,
                               String name,
                               Style parent)
Creates a new named style.

Parameters:
name - the style name
parent - the parent style
 o StyleContext.NamedStyle
public StyleContext.NamedStyle(StyleContext this$0,
                               Style parent)
Creates a new named style.

Parameters:
parent - the parent style
 o StyleContext.NamedStyle
public StyleContext.NamedStyle(StyleContext this$0)

Methods

 o toString
public String toString()
Converts the style to a string.

Returns:
the string
Overrides:
toString in class Object
 o getName
public String getName()
Fetches the name of the style. A style is not required to be named, so null is returned if there is no name associated with the style.

Returns:
the name
 o setName
public void setName(String name)
Changes the name of the style.

Parameters:
name - the new name
 o addChangeListener
public void addChangeListener(ChangeListener l)
Adds a change listener.

Parameters:
l - the change listener
See Also:
Attributes#addChangeListener
 o removeChangeListener
public void removeChangeListener(ChangeListener l)
Removes a change listener.

Parameters:
l - the change listener
See Also:
Attributes#removeChangeListener
 o fireStateChanged
protected void fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

See Also:
EventListenerList
 o isEmpty
public boolean isEmpty()
Checks whether any attributes have been defined.

Returns:
true if the attribute list is empty
See Also:
isEmpty
 o getAttributeCount
public int getAttributeCount()
Gets the number of attributes that are defined.

Returns:
the number of attributes
See Also:
getAttributeCount
 o isDefined
public boolean isDefined(String attrName)
Checks whether a given attribute is defined.

Parameters:
attrName - the attribute name
Returns:
true if the attribute is defined
See Also:
isDefined
 o isEqual
public boolean isEqual(AttributeSet attr)
Checks whether two attribute sets are equal.

Parameters:
attr - the attribute set to check against
Returns:
true if the same
See Also:
isEqual
 o copyAttributes
public AttributeSet copyAttributes()
Copies a set of attributes.

Returns:
the copy
See Also:
copyAttributes
 o getAttribute
public Object getAttribute(String attrName)
Gets the value of an attribute.

Parameters:
attrName - the attribute name
Returns:
the attribute value
See Also:
getAttribute
 o getAttributeNames
public Enumeration getAttributeNames()
Gets the names of all attributes.

Returns:
the attribute names
See Also:
getAttributeNames
 o containsAttribute
public boolean containsAttribute(String name,
                                 Object value)
Checks whether a given attribute name/value is defined.

Parameters:
name - the attribute name
value - the attribute value
Returns:
true if the name/value is defined
See Also:
containsAttribute
 o containsAttributes
public boolean containsAttributes(AttributeSet attrs)
Checks whether the element contains all the attributes.

Parameters:
attrs - the attributes to check
Returns:
true if the element contains all the attributes
See Also:
containsAttributes
 o getResolveParent
public AttributeSet getResolveParent()
If not overriden, the resolving parent defaults to the parent element.

Returns:
the attributes from the parent
See Also:
getResolveParent
 o addAttribute
public void addAttribute(String name,
                         Object value)
Adds an attribute.

Parameters:
name - the attribute name
value - the attribute value
See Also:
addAttribute
 o addAttributes
public void addAttributes(AttributeSet attr)
Adds a set of attributes to the element.

Parameters:
attr - the attributes to add
See Also:
addAttribute
 o removeAttribute
public void removeAttribute(String name)
Removes an attribute from the set.

Parameters:
name - the attribute name
See Also:
removeAttribute
 o removeAttributes
public void removeAttributes(Enumeration names)
Removes a set of attributes for the element.

Parameters:
names - the attribute names
See Also:
removeAttributes
 o removeAttributes
public void removeAttributes(AttributeSet attrs)
Removes a set of attributes for the element.

Parameters:
attrs - the attributes
See Also:
removeAttributes
 o setResolveParent
public void setResolveParent(MutableAttributeSet parent)
Sets the resolving parent.

Parameters:
parent - the parent
See Also:
setResolveParent

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature