public abstract class AbstractDocument.AbstractElement extends Objectimplements Element , MutableAttributeSet , Serializable , TreeNode
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 applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.
AttributeSet.CharacterAttribute , AttributeSet.ColorAttribute , AttributeSet.FontAttribute , AttributeSet.ParagraphAttribute NameAttribute, ResolveAttribute| Constructor and Description |
|---|
AbstractElement(Element
Creates a new AbstractElement.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(Object
Adds an attribute to the element.
|
void |
addAttributes(AttributeSet
Adds a set of attributes to the element.
|
abstract Enumeration |
children()
Returns the children of the receiver as an
Enumeration.
|
boolean |
containsAttribute(Object
Checks whether a given attribute name/value is defined.
|
boolean |
containsAttributes(AttributeSet
Checks whether the element contains all the attributes.
|
AttributeSet |
copyAttributes()
Copies a set of attributes.
|
void |
dump(PrintStream
Dumps a debugging representation of the element hierarchy.
|
abstract boolean |
getAllowsChildren()
Returns true if the receiver allows children.
|
Object |
getAttribute(Object
Gets the value of an attribute.
|
int |
getAttributeCount()
Gets the number of attributes that are defined.
|
Enumeration |
getAttributeNames()
Gets the names of all attributes.
|
AttributeSet |
getAttributes()
Gets the attributes for the element.
|
TreeNode |
getChildAt(int childIndex)
Returns the child
TreeNode at index
childIndex.
|
int |
getChildCount()
Returns the number of children
TreeNode's receiver contains.
|
Document |
getDocument()
Retrieves the underlying model.
|
abstract Element |
getElement(int index)
Gets a child element.
|
abstract int |
getElementCount()
Gets the number of children for the element.
|
abstract int |
getElementIndex(int offset)
Gets the child element index closest to the given model offset.
|
abstract int |
getEndOffset()
Gets the ending offset in the model for the element.
|
int |
getIndex(TreeNode
Returns the index of
node in the receivers children.
|
String |
getName()
Gets the name of the element.
|
TreeNode |
getParent()
Returns the parent
TreeNode of the receiver.
|
Element |
getParentElement()
Gets the parent of the element.
|
AttributeSet |
getResolveParent()
Gets the resolving parent.
|
abstract int |
getStartOffset()
Gets the starting offset in the model for the element.
|
boolean |
isDefined(Object
Checks whether a given attribute is defined.
|
boolean |
isEqual(AttributeSet
Checks whether two attribute sets are equal.
|
abstract boolean |
isLeaf()
Checks whether the element is a leaf.
|
void |
removeAttribute(Object
Removes an attribute from the set.
|
void |
removeAttributes(AttributeSet
Removes a set of attributes for the element.
|
void |
removeAttributes(Enumeration
Removes a set of attributes for the element.
|
void |
setResolveParent(AttributeSet
Sets the resolving parent.
|
public AbstractElement(Elementparent, AttributeSet a)
parent - the parent element
a - the attributes for the element
public void dump(PrintStreampsOut, int indentAmount)
psOut - the output stream
indentAmount - the indentation level >= 0
public int getAttributeCount()
getAttributeCount in interface
AttributeSet
AttributeSet.getAttributeCount()
public boolean isDefined(ObjectattrName)
isDefined in interface
AttributeSet
attrName - the non-null attribute name
AttributeSet.isDefined(java.lang.Object)
public boolean isEqual(AttributeSetattr)
isEqual in interface
AttributeSet
attr - the attribute set to check against
AttributeSet.isEqual(javax.swing.text.AttributeSet)
public AttributeSetcopyAttributes()
copyAttributes in interface
AttributeSet
AttributeSet.copyAttributes()
public ObjectgetAttribute(Object attrName)
getAttribute in interface
AttributeSet
attrName - the non-null attribute name
AttributeSet.getAttribute(java.lang.Object)
public Enumeration<?> getAttributeNames()
getAttributeNames in interface
AttributeSet
AttributeSet.getAttributeNames()
public boolean containsAttribute(Objectname, Object value)
containsAttribute in interface
AttributeSet
name - the non-null attribute name
value - the attribute value
AttributeSet.containsAttribute(java.lang.Object, java.lang.Object)
public boolean containsAttributes(AttributeSetattrs)
containsAttributes in interface
AttributeSet
attrs - the attributes to check
AttributeSet.containsAttributes(javax.swing.text.AttributeSet)
public AttributeSetgetResolveParent()
getResolveParent in interface
AttributeSet
null if none
AttributeSet.getResolveParent()
public void addAttribute(Objectname, Object value)
addAttribute in interface
MutableAttributeSet
name - the non-null attribute name
value - the attribute value
MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)
public void addAttributes(AttributeSetattr)
addAttributes in interface
MutableAttributeSet
attr - the attributes to add
MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)
public void removeAttribute(Objectname)
removeAttribute in interface
MutableAttributeSet
name - the non-null attribute name
MutableAttributeSet.removeAttribute(java.lang.Object)
public void removeAttributes(Enumeration<?> names)
removeAttributes in interface
MutableAttributeSet
names - the attribute names
MutableAttributeSet.removeAttributes(java.util.Enumeration<?>)
public void removeAttributes(AttributeSetattrs)
removeAttributes in interface
MutableAttributeSet
attrs - the attributes
MutableAttributeSet.removeAttributes(java.util.Enumeration<?>)
public void setResolveParent(AttributeSetparent)
setResolveParent in interface
MutableAttributeSet
parent - the parent, null if none
MutableAttributeSet.setResolveParent(javax.swing.text.AttributeSet)
public DocumentgetDocument()
getDocument in interface
Element
public ElementgetParentElement()
getParentElement in interface
Element
public AttributeSetgetAttributes()
getAttributes in interface
Element
public StringgetName()
public abstract int getStartOffset()
getStartOffset in interface
Element
Document,
AbstractDocument
public abstract int getEndOffset()
getEndOffset in interface
Element
Document,
AbstractDocument
public abstract ElementgetElement(int index)
getElement in interface
Element
index - the child index, >= 0 && < getElementCount()
public abstract int getElementCount()
getElementCount in interface
Element
public abstract int getElementIndex(int offset)
getElementIndex in interface
Element
offset - the offset >= 0
public abstract boolean isLeaf()
public TreeNodegetChildAt(int childIndex)
TreeNode at index
childIndex.
public int getChildCount()
TreeNode's receiver contains.
getChildCount in interface
TreeNode
TreeNodews's receiver contains
public TreeNodegetParent()
TreeNode of the receiver.
public int getIndex(TreeNodenode)
node in the receivers children. If the receiver does not contain
node, -1 will be returned.
public abstract boolean getAllowsChildren()
getAllowsChildren in interface
TreeNode
public abstract Enumerationchildren()
Enumeration.