Serializable
, AttributeSet
, Element
, MutableAttributeSet
, TreeNode
AbstractDocument.BranchElement
, AbstractDocument.LeafElement
AbstractDocument
public abstract class AbstractDocument.AbstractElement extends Object implements 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 | Description |
---|---|
AbstractElement |
Creates a new AbstractElement. |
Modifier and Type | Method | Description |
---|---|---|
void |
addAttribute |
Adds an attribute to the element. |
void |
addAttributes |
Adds a set of attributes to the element. |
abstract Enumeration |
children() |
Returns the children of the receiver as an Enumeration . |
boolean |
containsAttribute |
Checks whether a given attribute name/value is defined. |
boolean |
containsAttributes |
Checks whether the element contains all the attributes. |
AttributeSet |
copyAttributes() |
Copies a set of attributes. |
void |
dump |
Dumps a debugging representation of the element hierarchy. |
abstract boolean |
getAllowsChildren() |
Returns true if the receiver allows children. |
Object |
getAttribute |
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 |
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 |
Gets a child element. |
abstract int |
getElementCount() |
Gets the number of children for the element. |
abstract int |
getElementIndex |
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 |
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 |
Checks whether a given attribute is defined. |
boolean |
isEqual |
Checks whether two attribute sets are equal. |
abstract boolean |
isLeaf() |
Checks whether the element is a leaf. |
void |
removeAttribute |
Removes an attribute from the set. |
void |
removeAttributes |
Removes a set of attributes for the element. |
void |
removeAttributes |
Removes a set of attributes for the element. |
void |
setResolveParent |
Sets the resolving parent. |
public AbstractElement(Element parent, AttributeSet a)
parent
- the parent elementa
- the attributes for the elementpublic void dump(PrintStream psOut, int indentAmount)
psOut
- the output streamindentAmount
- the indentation level >= 0public int getAttributeCount()
getAttributeCount
in interface AttributeSet
public boolean isDefined(Object attrName)
isDefined
in interface AttributeSet
attrName
- the non-null attribute namepublic boolean isEqual(AttributeSet attr)
isEqual
in interface AttributeSet
attr
- the attribute set to check againstpublic AttributeSet copyAttributes()
copyAttributes
in interface AttributeSet
public Object getAttribute(Object attrName)
getAttribute
in interface AttributeSet
attrName
- the non-null attribute namepublic Enumeration<?> getAttributeNames()
getAttributeNames
in interface AttributeSet
public boolean containsAttribute(Object name, Object value)
containsAttribute
in interface AttributeSet
name
- the non-null attribute namevalue
- the attribute valuepublic boolean containsAttributes(AttributeSet attrs)
containsAttributes
in interface AttributeSet
attrs
- the attributes to checkpublic AttributeSet getResolveParent()
getResolveParent
in interface AttributeSet
null
if nonepublic void addAttribute(Object name, Object value)
addAttribute
in interface MutableAttributeSet
name
- the non-null attribute namevalue
- the attribute valuepublic void addAttributes(AttributeSet attr)
addAttributes
in interface MutableAttributeSet
attr
- the attributes to addpublic void removeAttribute(Object name)
removeAttribute
in interface MutableAttributeSet
name
- the non-null attribute namepublic void removeAttributes(Enumeration<?> names)
removeAttributes
in interface MutableAttributeSet
names
- the attribute namespublic void removeAttributes(AttributeSet attrs)
removeAttributes
in interface MutableAttributeSet
attrs
- the attributespublic void setResolveParent(AttributeSet parent)
setResolveParent
in interface MutableAttributeSet
parent
- the parent, null if nonepublic Document getDocument()
getDocument
in interface Element
public Element getParentElement()
getParentElement
in interface Element
public AttributeSet getAttributes()
getAttributes
in interface Element
public String getName()
public abstract int getStartOffset()
getStartOffset
in interface Element
public abstract int getEndOffset()
getEndOffset
in interface Element
public abstract Element getElement(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 >= 0public abstract boolean isLeaf()
public TreeNode getChildAt(int childIndex)
TreeNode
at index childIndex
.getChildAt
in interface TreeNode
childIndex
- index of childpublic int getChildCount()
TreeNode
's receiver contains.getChildCount
in interface TreeNode
TreeNodews
's receiver containspublic TreeNode getParent()
TreeNode
of the receiver.public int getIndex(TreeNode node)
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 Enumeration<TreeNode> children()
Enumeration
.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/text/AbstractDocument.AbstractElement.html