Class AbstractDocument.AbstractElement
- All Implemented Interfaces:
Serializable, AttributeSet, Element, MutableAttributeSet, TreeNode
- Direct Known Subclasses:
AbstractDocument.BranchElement, AbstractDocument.LeafElement
- Enclosing class:
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.
Nested Class Summary
Nested classes/interfaces declared in interface AttributeSet
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute | Modifier and Type | Interface | Description |
|---|---|---|
static interface |
AttributeSet.CharacterAttribute |
This interface is the type signature that is expected to be present on any attribute key that contributes to character level presentation. |
static interface |
AttributeSet.ColorAttribute |
This interface is the type signature that is expected to be present on any attribute key that contributes to presentation of color. |
static interface |
AttributeSet.FontAttribute |
This interface is the type signature that is expected to be present on any attribute key that contributes to the determination of what font to use to render some text. |
static interface |
AttributeSet.ParagraphAttribute |
This interface is the type signature that is expected to be present on any attribute key that contributes to the paragraph level presentation. |
Field Summary
Fields declared in interface AttributeSet
NameAttribute, ResolveAttribute | Modifier and Type | Field | Description |
|---|---|---|
static final Object |
NameAttribute |
Attribute name used to name the collection of attributes. |
static final Object |
ResolveAttribute |
Attribute name used to identify the resolving parent set of attributes, if one is defined. |
Constructor Summary
| Constructor | Description |
|---|---|
AbstractElement |
Creates a new AbstractElement. |
Method Summary
| 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. |
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | Modifier and Type | Method | Description |
|---|---|---|
protected Object |
clone() |
Creates and returns a copy of this object. |
boolean |
equals |
Indicates whether some other object is "equal to" this one. |
protected void |
finalize() |
Deprecated, for removal: This API element is subject to removal in a future version. Finalization is deprecated and subject to removal in a future release. |
final Class |
getClass() |
Returns the runtime class of this Object. |
int |
hashCode() |
Returns a hash code value for this object. |
final void |
notify() |
Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor. |
String |
toString() |
Returns a string representation of the object. |
final void |
wait() |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
Constructor Details
AbstractElement
public AbstractElement(Element parent, AttributeSet a)
- Parameters:
-
parent- the parent element -
a- the attributes for the element - Since:
- 1.4
Method Details
dump
public void dump(PrintStream psOut, int indentAmount)
- Parameters:
-
psOut- the output stream -
indentAmount- the indentation level >= 0
getAttributeCount
public int getAttributeCount()
- Specified by:
-
getAttributeCountin interfaceAttributeSet - Returns:
- the number of attributes >= 0
- See Also:
isDefined
public boolean isDefined(Object attrName)
- Specified by:
-
isDefinedin interfaceAttributeSet - Parameters:
-
attrName- the non-null attribute name - Returns:
- true if the attribute is defined
- See Also:
isEqual
public boolean isEqual(AttributeSet attr)
- Specified by:
-
isEqualin interfaceAttributeSet - Parameters:
-
attr- the attribute set to check against - Returns:
- true if the same
- See Also:
copyAttributes
public AttributeSet copyAttributes()
- Specified by:
-
copyAttributesin interfaceAttributeSet - Returns:
- the copy
- See Also:
getAttribute
public Object getAttribute(Object attrName)
- Specified by:
-
getAttributein interfaceAttributeSet - Parameters:
-
attrName- the non-null attribute name - Returns:
- the attribute value
- See Also:
getAttributeNames
public Enumeration<?> getAttributeNames()
- Specified by:
-
getAttributeNamesin interfaceAttributeSet - Returns:
- the attribute names as an enumeration
- See Also:
containsAttribute
public boolean containsAttribute(Object name, Object value)
- Specified by:
-
containsAttributein interfaceAttributeSet - Parameters:
-
name- the non-null attribute name -
value- the attribute value - Returns:
- true if the name/value is defined
- See Also:
containsAttributes
public boolean containsAttributes(AttributeSet attrs)
- Specified by:
-
containsAttributesin interfaceAttributeSet - Parameters:
-
attrs- the attributes to check - Returns:
- true if the element contains all the attributes
- See Also:
getResolveParent
public AttributeSet getResolveParent()
- Specified by:
-
getResolveParentin interfaceAttributeSet - Returns:
- the attributes from the parent,
nullif none - See Also:
addAttribute
public void addAttribute(Object name, Object value)
- Specified by:
-
addAttributein interfaceMutableAttributeSet - Parameters:
-
name- the non-null attribute name -
value- the attribute value - See Also:
addAttributes
public void addAttributes(AttributeSet attr)
- Specified by:
-
addAttributesin interfaceMutableAttributeSet - Parameters:
-
attr- the attributes to add - See Also:
removeAttribute
public void removeAttribute(Object name)
- Specified by:
-
removeAttributein interfaceMutableAttributeSet - Parameters:
-
name- the non-null attribute name - See Also:
removeAttributes
public void removeAttributes(Enumeration<?> names)
- Specified by:
-
removeAttributesin interfaceMutableAttributeSet - Parameters:
-
names- the attribute names - See Also:
removeAttributes
public void removeAttributes(AttributeSet attrs)
- Specified by:
-
removeAttributesin interfaceMutableAttributeSet - Parameters:
-
attrs- the attributes - See Also:
setResolveParent
public void setResolveParent(AttributeSet parent)
- Specified by:
-
setResolveParentin interfaceMutableAttributeSet - Parameters:
-
parent- the parent, null if none - See Also:
getDocument
public Document getDocument()
- Specified by:
-
getDocumentin interfaceElement - Returns:
- the model
getParentElement
public Element getParentElement()
- Specified by:
-
getParentElementin interfaceElement - Returns:
- the parent
getAttributes
public AttributeSet getAttributes()
- Specified by:
-
getAttributesin interfaceElement - Returns:
- the attribute set
getName
getStartOffset
public abstract int getStartOffset()
- Specified by:
-
getStartOffsetin interfaceElement - Returns:
- the offset >= 0
- See Also:
getEndOffset
public abstract int getEndOffset()
- Specified by:
-
getEndOffsetin interfaceElement - Returns:
- the offset >= 0
- See Also:
getElement
public abstract Element getElement(int index)
- Specified by:
-
getElementin interfaceElement - Parameters:
-
index- the child index, >= 0 && < getElementCount() - Returns:
- the child element
getElementCount
public abstract int getElementCount()
- Specified by:
-
getElementCountin interfaceElement - Returns:
- the number of children >= 0
getElementIndex
public abstract int getElementIndex(int offset)
- Specified by:
-
getElementIndexin interfaceElement - Parameters:
-
offset- the offset >= 0 - Returns:
- the element index >= 0
isLeaf
getChildAt
public TreeNode getChildAt(int childIndex)
TreeNode at index childIndex.- Specified by:
-
getChildAtin interfaceTreeNode - Parameters:
-
childIndex- index of child - Returns:
- the child node at given index
getChildCount
public int getChildCount()
TreeNode's receiver contains.- Specified by:
-
getChildCountin interfaceTreeNode - Returns:
- the number of children
TreeNode's receiver contains
getParent
getIndex
public int getIndex(TreeNode node)
node in the receivers children. If the receiver does not contain node, -1 will be returned.getAllowsChildren
public abstract boolean getAllowsChildren()
- Specified by:
-
getAllowsChildrenin interfaceTreeNode - Returns:
- true if the receiver allows children, otherwise false
children
© 1993, 2025, 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.