Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.swing.text.AbstractDocument.AbstractElement
public abstract class AbstractDocument.AbstractElement
extends Object
implements Element, MutableAttributeSet, TreeNode, Serializable
Element
interface.
Fields inherited from interface javax.swing.text.AttributeSet | |
NameAttribute , ResolveAttribute |
Constructor Summary | |
|
Method Summary | |
void |
|
void |
|
abstract Enumeration<E> | |
boolean |
|
boolean |
|
AttributeSet |
|
void |
|
abstract boolean |
|
Object |
|
int |
|
Enumeration |
|
AttributeSet |
|
TreeNode |
|
int |
|
Document |
|
abstract Element |
|
abstract int |
|
abstract int |
|
abstract int |
|
int | |
String |
|
TreeNode |
|
Element |
|
AttributeSet |
|
abstract int |
|
boolean | |
boolean |
|
abstract boolean |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public AbstractElement(Element p, AttributeSet s)
Creates a new instance ofAbstractElement
with a specified parentElement
andAttributeSet
.
- Parameters:
p
- the parent of thisAbstractElement
s
- the attributes to be assigned to thisAbstractElement
public void addAttribute(Object name, Object value)
Adds an attribute to this element.
- Specified by:
- addAttribute in interface MutableAttributeSet
- Parameters:
name
- the name of the attribute to be addedvalue
- the value of the attribute to be added
public void addAttributes(AttributeSet attrs)
Adds a set of attributes to this element.
- Specified by:
- addAttributes in interface MutableAttributeSet
- Parameters:
attrs
- the attributes to be added to this element
public abstract Enumeration<E> children()
- Returns:
- the child nodes of this
Element
as anEnumeration
ofTreeNode
s
public boolean containsAttribute(Object name, Object value)
Returnstrue
if this element contains the specified attribute.
- Specified by:
- containsAttribute in interface AttributeSet
- Parameters:
name
- the name of the attribute to checkvalue
- the value of the attribute to check
- Returns:
true
if this element contains the specified attribute
public boolean containsAttributes(AttributeSet attrs)
Returnstrue
if this element contains all of the specified attributes.
- Specified by:
- containsAttributes in interface AttributeSet
- Parameters:
attrs
- the attributes to check
- Returns:
true
if this element contains all of the specified attributes
public AttributeSet copyAttributes()
Returns a copy of the attributes of this element.
- Specified by:
- copyAttributes in interface AttributeSet
- Returns:
- a copy of the attributes of this element
public void dump(PrintStream stream, int indent)
Prints diagnostic output to the specified stream.
- Parameters:
stream
- the stream to write toindent
- the indentation level
public abstract boolean getAllowsChildren()
Returnstrue
if thisAbstractElement
allows children.
- Specified by:
- getAllowsChildren in interface TreeNode
- Returns:
true
if thisAbstractElement
allows children
public Object getAttribute(Object key)
Returns the attribute value with the specified key. If this attribute is not defined in this element and this element has a resolving parent, the search goes upward to the resolve parent chain.
- Specified by:
- getAttribute in interface AttributeSet
- Parameters:
key
- the key of the requested attribute
- Returns:
- the attribute value for
key
ofnull
ifkey
is not found locally and cannot be resolved in this element's resolve parents
public int getAttributeCount()
Returns the number of defined attributes in this element.
- Specified by:
- getAttributeCount in interface AttributeSet
- Returns:
- the number of defined attributes in this element
public Enumeration getAttributeNames()
Returns the names of the attributes of this element.
- Specified by:
- getAttributeNames in interface AttributeSet
- Returns:
- the names of the attributes of this element
public AttributeSet getAttributes()
Returns the attributes of this element.
- Specified by:
- getAttributes in interface Element
- Returns:
- the attributes of this element
public TreeNode getChildAt(int index)
Returns the child of thisAbstractElement
atindex
.
- Specified by:
- getChildAt in interface TreeNode
- Parameters:
index
- the position in the child list of the child element to be returned
- Returns:
- the child of this
AbstractElement
atindex
public int getChildCount()
Returns the number of children of thisAbstractElement
.
- Specified by:
- getChildCount in interface TreeNode
- Returns:
- the number of children of this
AbstractElement
public Document getDocument()
Returns theDocument
to which this element belongs.
- Specified by:
- getDocument in interface Element
- Returns:
- the
Document
to which this element belongs
public abstract Element getElement(int index)
Returns the child element at the specifiedindex
.
- Specified by:
- getElement in interface Element
- Parameters:
index
- the index of the requested child element
- Returns:
- the requested element
public abstract int getElementCount()
Returns the number of child elements of this element.
- Specified by:
- getElementCount in interface Element
- Returns:
- the number of child elements of this element
public abstract int getElementIndex(int offset)
Returns the index of the child element that spans the specified offset in the document model.
- Specified by:
- getElementIndex in interface Element
- Parameters:
offset
- the offset for which the responsible element is searched
- Returns:
- the index of the child element that spans the specified offset in the document model
public abstract int getEndOffset()
Returns the offset inside the document model that is after the last character of this element.
- Specified by:
- getEndOffset in interface Element
- Returns:
- the offset inside the document model that is after the last character of this element
public int getIndex(TreeNode node)
Returns the index of a given childTreeNode
or-1
ifnode
is not a child of thisAbstractElement
.
- Parameters:
node
- the node for which the index is requested
- Returns:
- the index of a given child
TreeNode
or-1
ifnode
is not a child of thisAbstractElement
public TreeNode getParent()
Returns the parentTreeNode
of thisAbstractElement
ornull
if this element has no parent.
- Returns:
- the parent
TreeNode
of thisAbstractElement
ornull
if this element has no parent
public Element getParentElement()
Returns the parent element of this element.
- Specified by:
- getParentElement in interface Element
- Returns:
- the parent element of this element
public AttributeSet getResolveParent()
Returns the resolve parent of this element. This is taken from the AttributeSet, but if this is null, this method instead returns the Element's parent's AttributeSet
- Specified by:
- getResolveParent in interface AttributeSet
- Returns:
- the resolve parent of this element
- See Also:
setResolveParent(AttributeSet)
public abstract int getStartOffset()
Returns the start offset if this element inside the document model.
- Specified by:
- getStartOffset in interface Element
- Returns:
- the start offset if this element inside the document model
public boolean isDefined(Object attrName)
Returnstrue
if an attribute with the specified name is defined in this element,false
otherwise.
- Specified by:
- isDefined in interface AttributeSet
- Parameters:
attrName
- the name of the requested attributes
- Returns:
true
if an attribute with the specified name is defined in this element,false
otherwise
public boolean isEqual(AttributeSet attrs)
Returnstrue
if the specifiedAttributeSet
is equal to this element'sAttributeSet
,false
otherwise.
- Specified by:
- isEqual in interface AttributeSet
- Parameters:
attrs
- the attributes to compare this element to
- Returns:
true
if the specifiedAttributeSet
is equal to this element'sAttributeSet
,false
otherwise
public abstract boolean isLeaf()
Returnstrue
if thisAbstractElement
is a leaf element,false
otherwise.
- Returns:
true
if thisAbstractElement
is a leaf element,false
otherwise
public void removeAttribute(Object name)
Removes an attribute from this element.
- Specified by:
- removeAttribute in interface MutableAttributeSet
- Parameters:
name
- the name of the attribute to be removed
public void removeAttributes(Enumeration names)
Removes a set of attribute from this element.
- Specified by:
- removeAttributes in interface MutableAttributeSet
- Parameters:
names
- the names of the attributes to be removed
public void removeAttributes(AttributeSet attrs)
Removes a set of attributes from this element.
- Specified by:
- removeAttributes in interface MutableAttributeSet
- Parameters:
attrs
- the attributes to be removed
public void setResolveParent(AttributeSet parent)
Sets the parent attribute set against which the element can resolve attributes that are not defined in itself.
- Specified by:
- setResolveParent in interface MutableAttributeSet
- Parameters:
parent
- the resolve parent to set