| Method from javax.swing.text.StyleContext$NamedStyle Detail: |
public void addAttribute(Object name,
Object value) {
StyleContext context = StyleContext.this;
attributes = context.addAttribute(attributes, name, value);
fireStateChanged();
}
|
public void addAttributes(AttributeSet attr) {
StyleContext context = StyleContext.this;
attributes = context.addAttributes(attributes, attr);
fireStateChanged();
}
Adds a set of attributes to the element. |
public void addChangeListener(ChangeListener l) {
listenerList.add(ChangeListener.class, l);
}
|
public boolean containsAttribute(Object name,
Object value) {
return attributes.containsAttribute(name, value);
}
Checks whether a given attribute name/value is defined. |
public boolean containsAttributes(AttributeSet attrs) {
return attributes.containsAttributes(attrs);
}
Checks whether the element contains all the attributes. |
public AttributeSet copyAttributes() {
NamedStyle a = new NamedStyle();
a.attributes = attributes.copyAttributes();
return a;
}
Copies a set of attributes. |
protected void fireStateChanged() {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length-2; i >=0; i-=2) {
if (listeners[i]==ChangeListener.class) {
// Lazily create the event:
if (changeEvent == null)
changeEvent = new ChangeEvent(this);
((ChangeListener)listeners[i+1]).stateChanged(changeEvent);
}
}
}
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. |
public Object getAttribute(Object attrName) {
return attributes.getAttribute(attrName);
}
Gets the value of an attribute. |
public int getAttributeCount() {
return attributes.getAttributeCount();
}
Gets the number of attributes that are defined. |
public Enumeration getAttributeNames() {
return attributes.getAttributeNames();
}
Gets the names of all attributes. |
public ChangeListener[] getChangeListeners() {
return (ChangeListener[])listenerList.getListeners(
ChangeListener.class);
}
Returns an array of all the ChangeListeners added
to this NamedStyle with addChangeListener(). |
public T[] getListeners(Class listenerType) {
return listenerList.getListeners(listenerType);
}
Return an array of all the listeners of the given type that
were added to this model. |
public String getName() {
if (isDefined(StyleConstants.NameAttribute)) {
return getAttribute(StyleConstants.NameAttribute).toString();
}
return null;
}
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. |
public AttributeSet getResolveParent() {
return attributes.getResolveParent();
}
Gets attributes from the parent.
If not overriden, the resolving parent defaults to
the parent element. |
public boolean isDefined(Object attrName) {
return attributes.isDefined(attrName);
}
Checks whether a given attribute is defined. |
public boolean isEqual(AttributeSet attr) {
return attributes.isEqual(attr);
}
Checks whether two attribute sets are equal. |
public void removeAttribute(Object name) {
StyleContext context = StyleContext.this;
attributes = context.removeAttribute(attributes, name);
fireStateChanged();
}
Removes an attribute from the set. |
public void removeAttributes(Enumeration names) {
StyleContext context = StyleContext.this;
attributes = context.removeAttributes(attributes, names);
fireStateChanged();
}
Removes a set of attributes for the element. |
public void removeAttributes(AttributeSet attrs) {
StyleContext context = StyleContext.this;
if (attrs == this) {
attributes = context.getEmptySet();
} else {
attributes = context.removeAttributes(attributes, attrs);
}
fireStateChanged();
}
Removes a set of attributes for the element. |
public void removeChangeListener(ChangeListener l) {
listenerList.remove(ChangeListener.class, l);
}
Removes a change listener. |
public void setName(String name) {
if (name != null) {
this.addAttribute(StyleConstants.NameAttribute, name);
}
}
Changes the name of the style. Does nothing with a null name. |
public void setResolveParent(AttributeSet parent) {
if (parent != null) {
addAttribute(StyleConstants.ResolveAttribute, parent);
} else {
removeAttribute(StyleConstants.ResolveAttribute);
}
}
Sets the resolving parent. |
public String toString() {
return "NamedStyle:" + getName() + " " + attributes;
}
Converts the style to a string. |