| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public abstract class AbstractDocument.AbstractElement extends Object implements Element, MutableAttributeSet, Serializable, TreeNode
Implements the abstract part of an element. By default elements support attributes by having a field that represents the immutable part of the current attribute set for the element. The element itself implements MutableAttributeSet which can be used to modify the set by fetching a new immutable set. The immutable sets are provided by the AttributeContext associated with the document.
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 JavaBeansTM
has been added to the java.beans
package.
Please see {@link java.beans.XMLEncoder}.
Constructor Summary | |
---|---|
AbstractDocument.AbstractElement(Element parent, AttributeSet a) Creates a new AbstractElement. |
Method Summary | |
---|---|
void |
addAttribute(Object name, Object value) Adds an attribute to the element. |
void |
addAttributes(AttributeSet attr) Adds a set of attributes to the element. |
abstract Enumeration |
children() Returns the children of the receiver as an Enumeration .
|
boolean |
containsAttribute(Object name, Object value) Checks whether a given attribute name/value is defined. |
boolean |
containsAttributes(AttributeSet attrs) Checks whether the element contains all the attributes. |
AttributeSet |
Copies a set of attributes. |
void |
dump(PrintStream psOut, int indentAmount) Dumps a debugging representation of the element hierarchy. |
abstract boolean |
Returns true if the receiver allows children. |
Object |
getAttribute(Object attrName) Gets the value of an attribute. |
int |
Gets the number of attributes that are defined. |
Enumeration |
Gets the names of all attributes. |
AttributeSet |
Gets the attributes for the element. |
TreeNode |
getChildAt(int childIndex) Returns the child TreeNode at index
childIndex .
|
int |
Returns the number of children TreeNode 's
receiver contains.
|
Document |
Retrieves the underlying model. |
abstract Element |
getElement(int index) Gets a child element. |
abstract int |
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 |
Gets the ending offset in the model for the element. |
int |
Returns the index of node in the receivers children.
|
String |
getName() Gets the name of the element. |
TreeNode |
Returns the parent TreeNode of the receiver.
|
Element |
Gets the parent of the element. |
AttributeSet |
Gets the resolving parent. |
abstract int |
Gets the starting offset in the model for the element. |
boolean |
Checks whether a given attribute is defined. |
boolean |
isEqual(AttributeSet attr) Checks whether two attribute sets are equal. |
abstract boolean |
isLeaf() Checks whether the element is a leaf. |
void |
removeAttribute(Object name) Removes an attribute from the set. |
void |
removeAttributes(AttributeSet attrs) Removes a set of attributes for the element. |
void |
removeAttributes(Enumeration names) Removes a set of attributes for the element. |
void |
setResolveParent(AttributeSet parent) Sets the resolving parent. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractDocument.AbstractElement(Element parent, AttributeSet a)
parent
- the parent elementa
- the attributes for the elementMethod Detail |
---|
public void addAttribute(Object name, Object value)
name
- the non-null attribute namevalue
- the attribute valuepublic void addAttributes(AttributeSet attr)
attr
- the attributes to addpublic abstract Enumeration children()
Enumeration
.
Enumeration
public boolean containsAttribute(Object name, Object value)
name
- the non-null attribute namevalue
- the attribute valuepublic boolean containsAttributes(AttributeSet attrs)
attrs
- the attributes to checkpublic AttributeSet copyAttributes()
public void dump(PrintStream psOut, int indentAmount)
psOut
- the output streamindentAmount
- the indentation level >= 0public abstract boolean getAllowsChildren()
public Object getAttribute(Object attrName)
attrName
- the non-null attribute namepublic int getAttributeCount()
public Enumeration getAttributeNames()
public AttributeSet getAttributes()
public TreeNode getChildAt(int childIndex)
TreeNode
at index
childIndex
.
childIndex
public int getChildCount()
TreeNode
's
receiver contains.
TreeNodews
's
receiver containspublic Document getDocument()
public abstract Element getElement(int index)
index
- the child index, >= 0 && < getElementCount()public abstract int getElementCount()
public abstract int getElementIndex(int offset)
offset
- the offset >= 0public abstract int getEndOffset()
public int getIndex(TreeNode node)
node
in the receivers children.
If the receiver does not contain node
, -1 will be
returned.
node
- the location of interestnode
in the receiver's
children, or -1 if absentpublic String getName()
public TreeNode getParent()
TreeNode
of the receiver.
TreeNode
of the receiverpublic Element getParentElement()
public AttributeSet getResolveParent()
null
if nonepublic abstract int getStartOffset()
public boolean isDefined(Object attrName)
attrName
- the non-null attribute namepublic boolean isEqual(AttributeSet attr)
attr
- the attribute set to check againstpublic abstract boolean isLeaf()
public void removeAttribute(Object name)
name
- the non-null attribute namepublic void removeAttributes(AttributeSet attrs)
attrs
- the attributespublic void removeAttributes(Enumeration names)
names
- the attribute namespublic void setResolveParent(AttributeSet parent)
parent
- the parent, null if none
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |