|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.text.AbstractDocument.AbstractElement
public abstract class AbstractDocument.AbstractElement
An abstract base implementation of the Element
interface.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface javax.swing.text.AttributeSet |
---|
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute |
Field Summary |
---|
Fields inherited from interface javax.swing.text.AttributeSet |
---|
NameAttribute, ResolveAttribute |
Constructor Summary | |
---|---|
AbstractDocument.AbstractElement(Element p,
AttributeSet s)
Creates a new instance of AbstractElement with a
specified parent Element and AttributeSet . |
Method Summary | |
---|---|
void |
addAttribute(Object name,
Object value)
Adds an attribute to this element. |
void |
addAttributes(AttributeSet attrs)
Adds a set of attributes to this element. |
abstract Enumeration |
children()
Returns the child nodes of this Element as an
Enumeration of TreeNode s. |
boolean |
containsAttribute(Object name,
Object value)
Returns true if this element contains the specified
attribute. |
boolean |
containsAttributes(AttributeSet attrs)
Returns true if this element contains all of the
specified attributes. |
AttributeSet |
copyAttributes()
Returns a copy of the attributes of this element. |
void |
dump(PrintStream stream,
int indent)
Prints diagnostic output to the specified stream. |
abstract boolean |
getAllowsChildren()
Returns true if this AbstractElement
allows children. |
Object |
getAttribute(Object key)
Returns the attribute value with the specified key. |
int |
getAttributeCount()
Returns the number of defined attributes in this element. |
Enumeration<?> |
getAttributeNames()
Returns the names of the attributes of this element. |
AttributeSet |
getAttributes()
Returns the attributes of this element. |
TreeNode |
getChildAt(int index)
Returns the child of this AbstractElement at
index . |
int |
getChildCount()
Returns the number of children of this AbstractElement . |
Document |
getDocument()
Returns the Document to which this element belongs. |
abstract Element |
getElement(int index)
Returns the child element at the specified index . |
abstract int |
getElementCount()
Returns the number of child elements of this element. |
abstract int |
getElementIndex(int offset)
Returns the index of the child element that spans the specified offset in the document model. |
abstract int |
getEndOffset()
Returns the offset inside the document model that is after the last character of this element. |
int |
getIndex(TreeNode node)
Returns the index of a given child TreeNode or
-1 if node is not a child of this
AbstractElement . |
String |
getName()
Returns the name of this element. |
TreeNode |
getParent()
Returns the parent TreeNode of this
AbstractElement or null if this element
has no parent. |
Element |
getParentElement()
Returns the parent element of this element. |
AttributeSet |
getResolveParent()
Returns the resolve parent of this element. |
abstract int |
getStartOffset()
Returns the start offset if this element inside the document model. |
boolean |
isDefined(Object attrName)
Returns true if an attribute with the specified name
is defined in this element, false otherwise. |
boolean |
isEqual(AttributeSet attrs)
Returns true if the specified AttributeSet
is equal to this element's AttributeSet , false
otherwise. |
abstract boolean |
isLeaf()
Returns true if this AbstractElement is a
leaf element, false otherwise. |
void |
removeAttribute(Object name)
Removes an attribute from this element. |
void |
removeAttributes(AttributeSet attrs)
Removes a set of attributes from this element. |
void |
removeAttributes(Enumeration<?> names)
Removes a set of attribute from this element. |
void |
setResolveParent(AttributeSet parent)
Sets the parent attribute set against which the element can resolve attributes that are not defined in itself. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractDocument.AbstractElement(Element p, AttributeSet s)
AbstractElement
with a
specified parent Element
and AttributeSet
.
p
- the parent of this AbstractElement
s
- the attributes to be assigned to this
AbstractElement
Method Detail |
---|
public abstract Enumeration children()
Element
as an
Enumeration
of TreeNode
s.
children
in interface TreeNode
Element
as an
Enumeration
of TreeNode
spublic abstract boolean getAllowsChildren()
true
if this AbstractElement
allows children.
getAllowsChildren
in interface TreeNode
true
if this AbstractElement
allows childrenpublic TreeNode getChildAt(int index)
AbstractElement
at
index
.
getChildAt
in interface TreeNode
index
- the position in the child list of the child element to
be returned
AbstractElement
at
index
public int getChildCount()
AbstractElement
.
getChildCount
in interface TreeNode
AbstractElement
public int getIndex(TreeNode node)
TreeNode
or
-1
if node
is not a child of this
AbstractElement
.
getIndex
in interface TreeNode
node
- the node for which the index is requested
TreeNode
or
-1
if node
is not a child of this
AbstractElement
public TreeNode getParent()
TreeNode
of this
AbstractElement
or null
if this element
has no parent.
getParent
in interface TreeNode
TreeNode
of this
AbstractElement
or null
if this
element has no parentpublic abstract boolean isLeaf()
true
if this AbstractElement
is a
leaf element, false
otherwise.
isLeaf
in interface Element
isLeaf
in interface TreeNode
true
if this AbstractElement
is a
leaf element, false
otherwisepublic void addAttribute(Object name, Object value)
addAttribute
in interface MutableAttributeSet
name
- the name of the attribute to be addedvalue
- the value of the attribute to be addedpublic void addAttributes(AttributeSet attrs)
addAttributes
in interface MutableAttributeSet
attrs
- the attributes to be added to this elementpublic void removeAttribute(Object name)
removeAttribute
in interface MutableAttributeSet
name
- the name of the attribute to be removedpublic void removeAttributes(AttributeSet attrs)
removeAttributes
in interface MutableAttributeSet
attrs
- the attributes to be removedpublic void removeAttributes(Enumeration<?> names)
removeAttributes
in interface MutableAttributeSet
names
- the names of the attributes to be removedpublic void setResolveParent(AttributeSet parent)
setResolveParent
in interface MutableAttributeSet
parent
- the resolve parent to setpublic boolean containsAttribute(Object name, Object value)
true
if this element contains the specified
attribute.
containsAttribute
in interface AttributeSet
name
- the name of the attribute to checkvalue
- the value of the attribute to check
true
if this element contains the specified
attributepublic boolean containsAttributes(AttributeSet attrs)
true
if this element contains all of the
specified attributes.
containsAttributes
in interface AttributeSet
attrs
- the attributes to check
true
if this element contains all of the
specified attributespublic AttributeSet copyAttributes()
copyAttributes
in interface AttributeSet
public Object getAttribute(Object key)
getAttribute
in interface AttributeSet
key
- the key of the requested attribute
key
of null
if key
is not found locally and cannot be resolved
in this element's resolve parentspublic int getAttributeCount()
getAttributeCount
in interface AttributeSet
public Enumeration<?> getAttributeNames()
getAttributeNames
in interface AttributeSet
public AttributeSet getResolveParent()
getResolveParent
in interface AttributeSet
setResolveParent(AttributeSet)
public boolean isDefined(Object attrName)
true
if an attribute with the specified name
is defined in this element, false
otherwise.
isDefined
in interface AttributeSet
attrName
- the name of the requested attributes
true
if an attribute with the specified name
is defined in this element, false
otherwisepublic boolean isEqual(AttributeSet attrs)
true
if the specified AttributeSet
is equal to this element's AttributeSet
, false
otherwise.
isEqual
in interface AttributeSet
attrs
- the attributes to compare this element to
true
if the specified AttributeSet
is equal to this element's AttributeSet
,
false
otherwisepublic AttributeSet getAttributes()
getAttributes
in interface Element
public Document getDocument()
Document
to which this element belongs.
getDocument
in interface Element
Document
to which this element belongspublic abstract Element getElement(int index)
index
.
getElement
in interface Element
index
- the index of the requested child element
public String getName()
getName
in interface Element
public Element getParentElement()
getParentElement
in interface Element
public abstract int getEndOffset()
getEndOffset
in interface Element
public abstract int getElementCount()
getElementCount
in interface Element
public abstract int getElementIndex(int offset)
getElementIndex
in interface Element
offset
- the offset for which the responsible element is searched
public abstract int getStartOffset()
getStartOffset
in interface Element
public void dump(PrintStream stream, int indent)
stream
- the stream to write toindent
- the indentation level
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |