Methods Summary |
---|
public boolean | containsAttribute(java.lang.Object name, java.lang.Object value)Checks whether a given attribute name/value is defined.
return value.equals(getAttribute(name));
|
public boolean | containsAttributes(javax.swing.text.AttributeSet attrs)Checks whether the attribute set contains all of
the given attributes.
boolean result = true;
Enumeration names = attrs.getAttributeNames();
while (result && names.hasMoreElements()) {
Object name = names.nextElement();
result = attrs.getAttribute(name).equals(getAttribute(name));
}
return result;
|
public javax.swing.text.AttributeSet | copyAttributes()Copies a set of attributes.
AttributeSet[] as = getAttributes();
MutableAttributeSet a = new SimpleAttributeSet();
int n = 0;
for (int i = as.length - 1; i >= 0; i--) {
a.addAttributes(as[i]);
}
return a;
|
public java.lang.Object | getAttribute(java.lang.Object key)Gets the value of an attribute. If the requested
attribute is a StyleConstants attribute that has
a CSS mapping, the request will be converted.
AttributeSet[] as = getAttributes();
int n = as.length;
for (int i = 0; i < n; i++) {
Object o = as[i].getAttribute(key);
if (o != null) {
return o;
}
}
return null;
|
public int | getAttributeCount()Gets the number of attributes that are defined.
AttributeSet[] as = getAttributes();
int n = 0;
for (int i = 0; i < as.length; i++) {
n += as[i].getAttributeCount();
}
return n;
|
public java.util.Enumeration | getAttributeNames()Gets the names of all attributes.
return new MuxingAttributeNameEnumeration();
|
protected synchronized javax.swing.text.AttributeSet[] | getAttributes()Returns the AttributeSet s multiplexing too. When the
AttributeSet s need to be referenced, this should be called.
return attrs;
|
public javax.swing.text.AttributeSet | getResolveParent()Returns null, subclasses may wish to do something more
intelligent with this.
return null;
|
protected synchronized void | insertAttributeSetAt(javax.swing.text.AttributeSet as, int index)Inserts as at index . This assumes
the value of index is between 0 and attrs.length,
inclusive.
int numAttrs = attrs.length;
AttributeSet newAttrs[] = new AttributeSet[numAttrs + 1];
if (index < numAttrs) {
if (index > 0) {
System.arraycopy(attrs, 0, newAttrs, 0, index);
System.arraycopy(attrs, index, newAttrs, index + 1,
numAttrs - index);
}
else {
System.arraycopy(attrs, 0, newAttrs, 1, numAttrs);
}
}
else {
System.arraycopy(attrs, 0, newAttrs, 0, numAttrs);
}
newAttrs[index] = as;
attrs = newAttrs;
|
public boolean | isDefined(java.lang.Object key)Checks whether a given attribute is defined.
This will convert the key over to CSS if the
key is a StyleConstants key that has a CSS
mapping.
AttributeSet[] as = getAttributes();
for (int i = 0; i < as.length; i++) {
if (as[i].isDefined(key)) {
return true;
}
}
return false;
|
public boolean | isEqual(javax.swing.text.AttributeSet attr)Checks whether two attribute sets are equal.
return ((getAttributeCount() == attr.getAttributeCount()) &&
containsAttributes(attr));
|
protected synchronized void | removeAttributeSetAt(int index)Removes the AttributeSet at index . This assumes
the value of index is greater than or equal to 0,
and less than attrs.length.
int numAttrs = attrs.length;
AttributeSet[] newAttrs = new AttributeSet[numAttrs - 1];
if (numAttrs > 0) {
if (index == 0) {
// FIRST
System.arraycopy(attrs, 1, newAttrs, 0, numAttrs - 1);
}
else if (index < (numAttrs - 1)) {
// MIDDLE
System.arraycopy(attrs, 0, newAttrs, 0, index);
System.arraycopy(attrs, index + 1, newAttrs, index,
numAttrs - index - 1);
}
else {
// END
System.arraycopy(attrs, 0, newAttrs, 0, numAttrs - 1);
}
}
attrs = newAttrs;
|
protected synchronized void | setAttributes(javax.swing.text.AttributeSet[] attrs)Directly sets the AttributeSet s that comprise this
MuxingAttributeSet .
this.attrs = attrs;
|