Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

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.

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 Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.


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

Constructor Summary
 StyleContext.NamedStyle(StyleContext this$0, String name, Style parent)
Creates a new named style.
 StyleContext.NamedStyle(StyleContext this$0, Style parent)
Creates a new named style.
 StyleContext.NamedStyle(StyleContext this$0)
Creates a new named style, with a null name and parent.
 

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.
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.
String  getName()
Fetches the name of the style.
AttributeSet  getResolveParent()
If not overriden, the resolving parent defaults to the parent element.
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(Enumeration names)
Removes a set of attributes for the element.
void  removeAttributes(AttributeSet attrs)
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, toString, wait, wait, wait
 

Field Detail

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".
Constructor Detail

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)
Creates a new named style, with a null name and parent.
Method Detail

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.
Implements:
getName in interface 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.
Implements:
addChangeListener in interface Style
Parameters:
l - the change listener
See Also:
Attributes#addChangeListener

removeChangeListener

public void removeChangeListener(ChangeListener l)
Removes a change listener.
Implements:
removeChangeListener in interface Style
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

getAttributeCount

public int getAttributeCount()
Gets the number of attributes that are defined.
Returns:
the number of attributes
See Also:
getAttributeCount

isDefined

public boolean isDefined(Object 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(Object 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(Object 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(Object 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(Object 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(AttributeSet parent)
Sets the resolving parent.
Parameters:
parent - the parent
See Also:
setResolveParent

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.