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.
changeEvent- Only one ChangeEvent is needed per model instance since the
event's only (read-only) state is the source property.
listenerList- The change listeners for the model.
StyleContext.NamedStyle(StyleContext)
-
StyleContext.NamedStyle(StyleContext, String, Style)
- Creates a new named style.
StyleContext.NamedStyle(StyleContext, Style)
- Creates a new named style.
addAttribute(String, Object)
- Adds an attribute.
addAttributes(AttributeSet)
- Adds a set of attributes to the element.
addChangeListener(ChangeListener)
- Adds a change listener.
containsAttribute(String, Object)
- Checks whether a given attribute name/value is defined.
containsAttributes(AttributeSet)
- Checks whether the element contains all the attributes.
copyAttributes()
- Copies a set of attributes.
fireStateChanged()
- Notifies all listeners that have registered interest for
notification on this event type.
getAttribute(String)
- Gets the value of an attribute.
getAttributeCount()
- Gets the number of attributes that are defined.
getAttributeNames()
- Gets the names of all attributes.
getName()
- Fetches the name of the style.
getResolveParent()
- If not overriden, the resolving parent defaults to
the parent element.
isDefined(String)
- Checks whether a given attribute is defined.
isEmpty()
- Checks whether any attributes have been defined.
isEqual(AttributeSet)
- Checks whether two attribute sets are equal.
removeAttribute(String)
- Removes an attribute from the set.
removeAttributes(AttributeSet)
- Removes a set of attributes for the element.
removeAttributes(Enumeration)
- Removes a set of attributes for the element.
removeChangeListener(ChangeListener)
- Removes a change listener.
setName(String)
- Changes the name of the style.
setResolveParent(MutableAttributeSet)
- Sets the resolving parent.
toString()
- Converts the style to a string.
listenerList
protected EventListenerList listenerList
- The change listeners for the model.
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".
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
StyleContext.NamedStyle
public StyleContext.NamedStyle(StyleContext this$0,
Style parent)
- Creates a new named style.
- Parameters:
- parent - the parent style
StyleContext.NamedStyle
public StyleContext.NamedStyle(StyleContext this$0)
toString
public String toString()
- Converts the style to a string.
- Returns:
- the string
- Overrides:
- toString in class Object
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
setName
public void setName(String name)
- Changes the name of the style.
- Parameters:
- name - the new name
addChangeListener
public void addChangeListener(ChangeListener l)
- Adds a change listener.
- Parameters:
- l - the change listener
- See Also:
- Attributes#addChangeListener
removeChangeListener
public void removeChangeListener(ChangeListener l)
- Removes a change listener.
- Parameters:
- l - the change listener
- See Also:
- Attributes#removeChangeListener
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
isEmpty
public boolean isEmpty()
- Checks whether any attributes have been defined.
- Returns:
- true if the attribute list is empty
- See Also:
- isEmpty
getAttributeCount
public int getAttributeCount()
- Gets the number of attributes that are defined.
- Returns:
- the number of attributes
- See Also:
- getAttributeCount
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
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
copyAttributes
public AttributeSet copyAttributes()
- Copies a set of attributes.
- Returns:
- the copy
- See Also:
- copyAttributes
getAttribute
public Object getAttribute(String attrName)
- Gets the value of an attribute.
- Parameters:
- attrName - the attribute name
- Returns:
- the attribute value
- See Also:
- getAttribute
getAttributeNames
public Enumeration getAttributeNames()
- Gets the names of all attributes.
- Returns:
- the attribute names
- See Also:
- getAttributeNames
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
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
getResolveParent
public AttributeSet getResolveParent()
- If not overriden, the resolving parent defaults to
the parent element.
- Returns:
- the attributes from the parent
- See Also:
- getResolveParent
addAttribute
public void addAttribute(String name,
Object value)
- Adds an attribute.
- Parameters:
- name - the attribute name
- value - the attribute value
- See Also:
- addAttribute
addAttributes
public void addAttributes(AttributeSet attr)
- Adds a set of attributes to the element.
- Parameters:
- attr - the attributes to add
- See Also:
- addAttribute
removeAttribute
public void removeAttribute(String name)
- Removes an attribute from the set.
- Parameters:
- name - the attribute name
- See Also:
- removeAttribute
removeAttributes
public void removeAttributes(Enumeration names)
- Removes a set of attributes for the element.
- Parameters:
- names - the attribute names
- See Also:
- removeAttributes
removeAttributes
public void removeAttributes(AttributeSet attrs)
- Removes a set of attributes for the element.
- Parameters:
- attrs - the attributes
- See Also:
- removeAttributes
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