API java : AbstractDocument.AbstractElement


javax.swing.text
Class AbstractDocument.AbstractElement

java.lang.Object
  extended by javax.swing.text.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

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 XMLEncoder.


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 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 copyAttributes()
          Copies a set of attributes.
 void dump(PrintStream psOut, int indentAmount)
          Dumps a debugging representation of the element hierarchy.
abstract  boolean getAllowsChildren()
          Returns true if the receiver allows children.
 Object getAttribute(Object attrName)
          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(int childIndex)
          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(int index)
          Gets a child element.
abstract  int getElementCount()
          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 getEndOffset()
          Gets the ending offset in the model for the element.
 int getIndex(TreeNode node)
          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(Object attrName)
          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

AbstractDocument.AbstractElement

public AbstractDocument.AbstractElement(Element parent,
                                        AttributeSet a)
Creates a new AbstractElement.

Parameters:
parent - the parent element
a - the attributes for the element
Method Detail

dump

public void dump(PrintStream psOut,
                 int indentAmount)
Dumps a debugging representation of the element hierarchy.

Parameters:
psOut - the output stream
indentAmount - the indentation level >= 0

getAttributeCount

public int getAttributeCount()
Gets the number of attributes that are defined.

Specified by:
getAttributeCount in interface AttributeSet
Returns:
the number of attributes >= 0
See Also:
AttributeSet.getAttributeCount()

isDefined

public boolean isDefined(Object attrName)
Checks whether a given attribute is defined.

Specified by:
isDefined in interface AttributeSet
Parameters:
attrName - the non-null attribute name
Returns:
true if the attribute is defined
See Also:
AttributeSet.isDefined(java.lang.Object)

isEqual

public boolean isEqual(AttributeSet attr)
Checks whether two attribute sets are equal.

Specified by:
isEqual in interface AttributeSet
Parameters:
attr - the attribute set to check against
Returns:
true if the same
See Also:
AttributeSet.isEqual(javax.swing.text.AttributeSet)

copyAttributes

public AttributeSet copyAttributes()
Copies a set of attributes.

Specified by:
copyAttributes in interface AttributeSet
Returns:
the copy
See Also:
AttributeSet.copyAttributes()

getAttribute

public Object getAttribute(Object attrName)
Gets the value of an attribute.

Specified by:
getAttribute in interface AttributeSet
Parameters:
attrName - the non-null attribute name
Returns:
the attribute value
See Also:
AttributeSet.getAttribute(java.lang.Object)

getAttributeNames

public Enumeration<?> getAttributeNames()
Gets the names of all attributes.

Specified by:
getAttributeNames in interface AttributeSet
Returns:
the attribute names as an enumeration
See Also:
AttributeSet.getAttributeNames()

containsAttribute

public boolean containsAttribute(Object name,
                                 Object value)
Checks whether a given attribute name/value is defined.

Specified by:
containsAttribute in interface AttributeSet
Parameters:
name - the non-null attribute name
value - the attribute value
Returns:
true if the name/value is defined
See Also:
AttributeSet.containsAttribute(java.lang.Object, java.lang.Object)

containsAttributes

public boolean containsAttributes(AttributeSet attrs)
Checks whether the element contains all the attributes.

Specified by:
containsAttributes in interface AttributeSet
Parameters:
attrs - the attributes to check
Returns:
true if the element contains all the attributes
See Also:
AttributeSet.containsAttributes(javax.swing.text.AttributeSet)

getResolveParent

public AttributeSet getResolveParent()
Gets the resolving parent. If not overridden, the resolving parent defaults to the parent element.

Specified by:
getResolveParent in interface AttributeSet
Returns:
the attributes from the parent, null if none
See Also:
AttributeSet.getResolveParent()

addAttribute

public void addAttribute(Object name,
                         Object value)
Adds an attribute to the element.

Specified by:
addAttribute in interface MutableAttributeSet
Parameters:
name - the non-null attribute name
value - the attribute value
See Also:
MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)

addAttributes

public void addAttributes(AttributeSet attr)
Adds a set of attributes to the element.

Specified by:
addAttributes in interface MutableAttributeSet
Parameters:
attr - the attributes to add
See Also:
MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)

removeAttribute

public void removeAttribute(Object name)
Removes an attribute from the set.

Specified by:
removeAttribute in interface MutableAttributeSet
Parameters:
name - the non-null attribute name
See Also:
MutableAttributeSet.removeAttribute(java.lang.Object)

removeAttributes

public void removeAttributes(Enumeration<?> names)
Removes a set of attributes for the element.

Specified by:
removeAttributes in interface MutableAttributeSet
Parameters:
names - the attribute names
See Also:
MutableAttributeSet.removeAttributes(java.util.Enumeration)

removeAttributes

public void removeAttributes(AttributeSet attrs)
Removes a set of attributes for the element.

Specified by:
removeAttributes in interface MutableAttributeSet
Parameters:
attrs - the attributes
See Also:
MutableAttributeSet.removeAttributes(java.util.Enumeration)

setResolveParent

public void setResolveParent(AttributeSet parent)
Sets the resolving parent.

Specified by:
setResolveParent in interface MutableAttributeSet
Parameters:
parent - the parent, null if none
See Also:
MutableAttributeSet.setResolveParent(javax.swing.text.AttributeSet)

getDocument

public Document getDocument()
Retrieves the underlying model.

Specified by:
getDocument in interface Element
Returns:
the model

getParentElement

public Element getParentElement()
Gets the parent of the element.

Specified by:
getParentElement in interface Element
Returns:
the parent

getAttributes

public AttributeSet getAttributes()
Gets the attributes for the element.

Specified by:
getAttributes in interface Element
Returns:
the attribute set

getName

public String getName()
Gets the name of the element.

Specified by:
getName in interface Element
Returns:
the name, null if none

getStartOffset

public abstract int getStartOffset()
Gets the starting offset in the model for the element.

Specified by:
getStartOffset in interface Element
Returns:
the offset >= 0
See Also:
Document, AbstractDocument

getEndOffset

public abstract int getEndOffset()
Gets the ending offset in the model for the element.

Specified by:
getEndOffset in interface Element
Returns:
the offset >= 0
See Also:
Document, AbstractDocument

getElement

public abstract Element getElement(int index)
Gets a child element.

Specified by:
getElement in interface Element
Parameters:
index - the child index, >= 0 && < getElementCount()
Returns:
the child element

getElementCount

public abstract int getElementCount()
Gets the number of children for the element.

Specified by:
getElementCount in interface Element
Returns:
the number of children >= 0

getElementIndex

public abstract int getElementIndex(int offset)
Gets the child element index closest to the given model offset.

Specified by:
getElementIndex in interface Element
Parameters:
offset - the offset >= 0
Returns:
the element index >= 0

isLeaf

public abstract boolean isLeaf()
Checks whether the element is a leaf.

Specified by:
isLeaf in interface Element
Specified by:
isLeaf in interface TreeNode
Returns:
true if a leaf

getChildAt

public TreeNode getChildAt(int childIndex)
Returns the child TreeNode at index childIndex.

Specified by:
getChildAt in interface TreeNode

getChildCount

public int getChildCount()
Returns the number of children TreeNode's receiver contains.

Specified by:
getChildCount in interface TreeNode
Returns:
the number of children TreeNodews's receiver contains

getParent

public TreeNode getParent()
Returns the parent TreeNode of the receiver.

Specified by:
getParent in interface TreeNode
Returns:
the parent TreeNode of the receiver

getIndex

public int getIndex(TreeNode node)
Returns the index of node in the receivers children. If the receiver does not contain node, -1 will be returned.

Specified by:
getIndex in interface TreeNode
Parameters:
node - the location of interest
Returns:
the index of node in the receiver's children, or -1 if absent

getAllowsChildren

public abstract boolean getAllowsChildren()
Returns true if the receiver allows children.

Specified by:
getAllowsChildren in interface TreeNode
Returns:
true if the receiver allows children, otherwise false

children

public abstract Enumeration children()
Returns the children of the receiver as an Enumeration.

Specified by:
children in interface TreeNode
Returns:
the children of the receiver as an Enumeration

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

8 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-9165
Document créé le 06/12/06 22:48, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-javax/swing/text/AbstractDocument.AbstractElement.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
2,93 secondes

Mises à jour :
Mises à jour du site
Citation (masquer)
Nos désirs sont les pressentiments des possibilités qui sont en nous.

Goethe
 
l'infobrol
Nous sommes le Samedi 02 Juin 2012, 08:39, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)