Java: Swing: Text components and Document: Element names
These are "known" (i.e. occuring) element names in the text package. Although only AbstractDocument has some policy for element names (and not Document or StyledDocument), creation of Views is (by default) for all Documents done on element names (at least the leaf state should also be checked?), and that's also about the only place where the names matter at all.
Name | Definition class Field name | Use |
|---|---|---|
section | AbstractDocument SectionElementName | default root element of DefaultStyledDocument StyledEditorKit -> BoxView(Y) |
paragraph | AbstractDocument ParagraphElementName | default root element of PlainDocument (why?) StyledEditorKit -> ParagraphView |
content | AbstractDocument ContentElementName | default element for leaves StyledEditorKit -> LabelView |
bidi root | bidi root element of AbstractDocument The name itself is never used. DefaultCaret, TextLayoutStrategy inspect the bidi structure | |
bidi level | AbstractDocument BidiElementName | children of bidi root, have attribute bidiLevel (see StyleConstants) The name itself is never used. DefaultCaret, TextLayoutStrategy inspect the bidi structure |
component | StyleConstants ComponentElementName | StyleConstants.setComponent StyledEditorKit -> ComponentView MinimalHTMLWriter (ignores) |
icon | StyleConstants IconElementName | StyleConstants.setIcon StyledEditorKit -> IconView MinimalHTMLWriter (ignores) |
The latter two (or any element name) can be set from the outside (by insertString/setCharacterAttributes/setParagraphAttributes for elements) with elements which take the value of the attribute AbstractDocument.ElementNameAttribute as their name. Subclasses of AbstractDocument.AbstractElement do that (if it is not overridden in subclasses, which it is for HTMLDocument's elements). This leads to the problem that changes to this attribute will not (at once) recreate the View. (The same happens with HTMLEditorKit for the attribute set's name attribute)
HTMLEditorKit falls back to the behaviour of StyledEditorKit if it cannot find the HTML.Tag attribute
html/HiddenTagView: sets name from JTextField contents
(C) 2001-2009 Christian Kaufhold (swing@chka.de)