Liking cljdoc? Tell your friends :D

javax.swing.text.html.BlockView

A view implementation to display a block (as a box) with CSS specifications.

A view implementation to display a block (as a box)
with CSS specifications.
raw docstring

javax.swing.text.html.core

No vars found in this namespace.

javax.swing.text.html.CSS

Defines a set of CSS attributes as a typesafe enumeration. The HTML View implementations use CSS attributes to determine how they will render. This also defines methods to map between CSS/HTML/StyleConstants. Any shorthand properties, such as font, are mapped to the intrinsic properties. The following describes the CSS properties that are supported by the rendering engine: font-family font-style font-size (supports relative units) font-weight font color background-color (with the exception of transparent) background-image background-repeat background-position background text-decoration (with the exception of blink and overline) vertical-align (only sup and super) text-align (justify is treated as center) margin-top margin-right margin-bottom margin-left margin padding-top padding-right padding-bottom padding-left padding border-top-style border-right-style border-bottom-style border-left-style border-style (only supports inset, outset and none) border-top-color border-right-color border-bottom-color border-left-color border-color list-style-image list-style-type list-style-position

The following are modeled, but currently not rendered. font-variant background-attachment (background always treated as scroll) word-spacing letter-spacing text-indent text-transform line-height border-top-width (this is used to indicate if a border should be used) border-right-width border-bottom-width border-left-width border-width border-top border-right border-bottom border-left border width height float clear display white-space list-style

Note: for the time being we do not fully support relative units, unless noted, so that p { margin-top: 10% } will be treated as if no margin-top was specified.

Defines a set of
CSS attributes
as a typesafe enumeration.  The HTML View implementations use
CSS attributes to determine how they will render. This also defines
methods to map between CSS/HTML/StyleConstants. Any shorthand
properties, such as font, are mapped to the intrinsic properties.
The following describes the CSS properties that are supported by the
rendering engine:
font-family
  font-style
  font-size (supports relative units)
  font-weight
  font
  color
  background-color (with the exception of transparent)
  background-image
  background-repeat
  background-position
  background
  text-decoration (with the exception of blink and overline)
  vertical-align (only sup and super)
  text-align (justify is treated as center)
  margin-top
  margin-right
  margin-bottom
  margin-left
  margin
  padding-top
  padding-right
  padding-bottom
  padding-left
  padding
  border-top-style
  border-right-style
  border-bottom-style
  border-left-style
  border-style (only supports inset, outset and none)
  border-top-color
  border-right-color
  border-bottom-color
  border-left-color
  border-color
  list-style-image
  list-style-type
  list-style-position

The following are modeled, but currently not rendered.
font-variant
  background-attachment (background always treated as scroll)
  word-spacing
  letter-spacing
  text-indent
  text-transform
  line-height
  border-top-width (this is used to indicate if a border should be used)
  border-right-width
  border-bottom-width
  border-left-width
  border-width
  border-top
  border-right
  border-bottom
  border-left
  border
  width
  height
  float
  clear
  display
  white-space
  list-style

Note: for the time being we do not fully support relative units,
unless noted, so that
p { margin-top: 10% } will be treated as if no margin-top was specified.
raw docstring

javax.swing.text.html.FormSubmitEvent

FormSubmitEvent is used to notify interested parties that a form was submitted.

FormSubmitEvent is used to notify interested
parties that a form was submitted.
raw docstring

javax.swing.text.html.FormView

Component decorator that implements the view interface for form elements, <input>, <textarea>, and <select>. The model for the component is stored as an attribute of the the element (using StyleConstants.ModelAttribute), and is used to build the component of the view. The type of the model is assumed to of the type that would be set by HTMLDocument.HTMLReader.FormAction. If there are multiple views mapped over the document, they will share the embedded component models.

The following table shows what components get built by this view.

Element Type Component built

input, type button JButton

input, type checkbox JCheckBox

input, type image JButton

input, type password JPasswordField

input, type radio JRadioButton

input, type reset JButton

input, type submit JButton

input, type text JTextField

select, size > 1 or multiple attribute defined JList in a JScrollPane

select, size unspecified or 1 JComboBox

textarea JTextArea in a JScrollPane

input, type file JTextField

Component decorator that implements the view interface
for form elements, <input>, <textarea>,
and <select>.  The model for the component is stored
as an attribute of the the element (using StyleConstants.ModelAttribute),
and is used to build the component of the view.  The type
of the model is assumed to of the type that would be set by
HTMLDocument.HTMLReader.FormAction.  If there are
multiple views mapped over the document, they will share the
embedded component models.

The following table shows what components get built
by this view.


  Element Type
  Component built


  input, type button
  JButton


  input, type checkbox
  JCheckBox


  input, type image
  JButton


  input, type password
  JPasswordField


  input, type radio
  JRadioButton


  input, type reset
  JButton


  input, type submit
  JButton


  input, type text
  JTextField


  select, size > 1 or multiple attribute defined
  JList in a JScrollPane


  select, size unspecified or 1
  JComboBox


  textarea
  JTextArea in a JScrollPane


  input, type file
  JTextField
raw docstring

javax.swing.text.html.HTML

Constants used in the HTMLDocument. These are basically tag and attribute definitions.

Constants used in the HTMLDocument.  These
are basically tag and attribute definitions.
raw docstring

javax.swing.text.html.HTML$Tag

Typesafe enumeration for an HTML tag. Although the set of HTML tags is a closed set, we have left the set open so that people can add their own tag types to their custom parser and still communicate to the reader.

Typesafe enumeration for an HTML tag.  Although the
set of HTML tags is a closed set, we have left the
set open so that people can add their own tag types
to their custom parser and still communicate to the
reader.
raw docstring

javax.swing.text.html.HTMLDocument

A document that models HTML. The purpose of this model is to support both browsing and editing. As a result, the structure described by an HTML document is not exactly replicated by default. The element structure that is modeled by default, is built by the class HTMLDocument.HTMLReader, which implements the HTMLEditorKit.ParserCallback protocol that the parser expects. To change the structure one can subclass HTMLReader, and reimplement the method getReader(int) to return the new reader implementation. The documentation for HTMLReader should be consulted for the details of the default structure created. The intent is that the document be non-lossy (although reproducing the HTML format may result in a different format).

The document models only HTML, and makes no attempt to store view attributes in it. The elements are identified by the StyleContext.NameAttribute attribute, which should always have a value of type HTML.Tag that identifies the kind of element. Some of the elements (such as comments) are synthesized. The HTMLFactory uses this attribute to determine what kind of view to build.

This document supports incremental loading. The TokenThreshold property controls how much of the parse is buffered before trying to update the element structure of the document. This property is set by the EditorKit so that subclasses can disable it.

The Base property determines the URL against which relative URLs are resolved. By default, this will be the Document.StreamDescriptionProperty if the value of the property is a URL. If a <BASE> tag is encountered, the base will become the URL specified by that tag. Because the base URL is a property, it can of course be set directly.

The default content storage mechanism for this document is a gap buffer (GapContent). Alternatives can be supplied by using the constructor that takes a Content implementation.

Modifying HTMLDocument

In addition to the methods provided by Document and StyledDocument for mutating an HTMLDocument, HTMLDocument provides a number of convenience methods. The following methods can be used to insert HTML content into an existing document.

setInnerHTML(Element, String) setOuterHTML(Element, String) insertBeforeStart(Element, String) insertAfterStart(Element, String) insertBeforeEnd(Element, String) insertAfterEnd(Element, String)

The following examples illustrate using these methods. Each example assumes the HTML document is initialized in the following way:

JEditorPane p = new JEditorPane(); p.setContentType("text/html"); p.setText("..."); // Document text is provided below. HTMLDocument d = (HTMLDocument) p.getDocument();

With the following HTML content:

<html> <head> <title>An example HTMLDocument</title> <style type="text/css"> div { background-color: silver; } ul { color: red; } </style> </head> <body> <div id="BOX"> <p>Paragraph 1</p> <p>Paragraph 2</p> </div> </body> </html>

All the methods for modifying an HTML document require an Element. Elements can be obtained from an HTML document by using the method getElement(Element e, Object attribute, Object value). It returns the first descendant element that contains the specified attribute with the given value, in depth-first order. For example, d.getElement(d.getDefaultRootElement(), StyleConstants.NameAttribute, HTML.Tag.P) returns the first paragraph element.

A convenient shortcut for locating elements is the method getElement(String); returns an element whose ID attribute matches the specified value. For example, d.getElement("BOX") returns the DIV element.

The getIterator(HTML.Tag t) method can also be used for finding all occurrences of the specified HTML tag in the document.

Inserting elements

Elements can be inserted before or after the existing children of any non-leaf element by using the methods insertAfterStart and insertBeforeEnd. For example, if e is the DIV element, d.insertAfterStart(e, "<ul><li>List Item</li></ul>") inserts the list before the first paragraph, and d.insertBeforeEnd(e, "<ul><li>List Item</li></ul>") inserts the list after the last paragraph. The DIV block becomes the parent of the newly inserted elements.

Sibling elements can be inserted before or after any element by using the methods insertBeforeStart and insertAfterEnd. For example, if e is the DIV element, d.insertBeforeStart(e, "<ul><li>List Item</li></ul>") inserts the list before the DIV element, and d.insertAfterEnd(e, "<ul><li>List Item</li></ul>") inserts the list after the DIV element. The newly inserted elements become siblings of the DIV element.

Replacing elements

Elements and all their descendants can be replaced by using the methods setInnerHTML and setOuterHTML. For example, if e is the DIV element, d.setInnerHTML(e, "<ul><li>List Item</li></ul>") replaces all children paragraphs with the list, and d.setOuterHTML(e, "<ul><li>List Item</li></ul>") replaces the DIV element itself. In latter case the parent of the list is the BODY element.

Summary

The following table shows the example document and the results of various methods described above.

Example
insertAfterStart
insertBeforeEnd
insertBeforeStart
insertAfterEnd
setInnerHTML
setOuterHTML




    Paragraph 1
    Paragraph 2

insertAfterStart

      List Item

    Paragraph 1
    Paragraph 2

insertBeforeEnd

    Paragraph 1
    Paragraph 2

      List Item

insertBeforeStart

    List Item


    Paragraph 1
    Paragraph 2

insertAfterEnd

    Paragraph 1
    Paragraph 2


    List Item

setInnerHTML

      List Item

setOuterHTML

    List Item

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 JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A document that models HTML.  The purpose of this model is to
support both browsing and editing.  As a result, the structure
described by an HTML document is not exactly replicated by default.
The element structure that is modeled by default, is built by the
class HTMLDocument.HTMLReader, which implements the
HTMLEditorKit.ParserCallback protocol that the parser
expects.  To change the structure one can subclass
HTMLReader, and reimplement the method getReader(int) to return the new reader implementation.  The
documentation for HTMLReader should be consulted for
the details of the default structure created.  The intent is that
the document be non-lossy (although reproducing the HTML format may
result in a different format).

The document models only HTML, and makes no attempt to store
view attributes in it.  The elements are identified by the
StyleContext.NameAttribute attribute, which should
always have a value of type HTML.Tag that identifies
the kind of element.  Some of the elements (such as comments) are
synthesized.  The HTMLFactory uses this attribute to
determine what kind of view to build.

This document supports incremental loading.  The
TokenThreshold property controls how much of the parse
is buffered before trying to update the element structure of the
document.  This property is set by the EditorKit so
that subclasses can disable it.

The Base property determines the URL against which
relative URLs are resolved.  By default, this will be the
Document.StreamDescriptionProperty if the value of the
property is a URL.  If a <BASE> tag is encountered, the base
will become the URL specified by that tag.  Because the base URL is
a property, it can of course be set directly.

The default content storage mechanism for this document is a gap
buffer (GapContent).  Alternatives can be supplied by
using the constructor that takes a Content
implementation.

Modifying HTMLDocument

In addition to the methods provided by Document and
StyledDocument for mutating an HTMLDocument, HTMLDocument provides
a number of convenience methods.  The following methods can be used
to insert HTML content into an existing document.


  setInnerHTML(Element, String)
  setOuterHTML(Element, String)
  insertBeforeStart(Element, String)
  insertAfterStart(Element, String)
  insertBeforeEnd(Element, String)
  insertAfterEnd(Element, String)


The following examples illustrate using these methods.  Each
example assumes the HTML document is initialized in the following
way:



JEditorPane p = new JEditorPane();
p.setContentType("text/html");
p.setText("..."); // Document text is provided below.
HTMLDocument d = (HTMLDocument) p.getDocument();

With the following HTML content:



<html>
  <head>
    <title>An example HTMLDocument</title>
    <style type="text/css">
      div { background-color: silver; }
      ul { color: red; }
    </style>
  </head>
  <body>
    <div id="BOX">
      <p>Paragraph 1</p>
      <p>Paragraph 2</p>
    </div>
  </body>
</html>

All the methods for modifying an HTML document require an Element.  Elements can be obtained from an HTML document by using
the method getElement(Element e, Object attribute, Object
value).  It returns the first descendant element that contains the
specified attribute with the given value, in depth-first order.
For example, d.getElement(d.getDefaultRootElement(),
StyleConstants.NameAttribute, HTML.Tag.P) returns the first
paragraph element.

A convenient shortcut for locating elements is the method getElement(String); returns an element whose ID
attribute matches the specified value.  For example,
d.getElement("BOX") returns the DIV
element.

The getIterator(HTML.Tag t) method can also be used for
finding all occurrences of the specified HTML tag in the
document.

Inserting elements

Elements can be inserted before or after the existing children
of any non-leaf element by using the methods
insertAfterStart and insertBeforeEnd.
For example, if e is the DIV element,
d.insertAfterStart(e, "<ul><li>List
Item</li></ul>") inserts the list before the first
paragraph, and d.insertBeforeEnd(e, "<ul><li>List
Item</li></ul>") inserts the list after the last
paragraph.  The DIV block becomes the parent of the
newly inserted elements.

Sibling elements can be inserted before or after any element by
using the methods insertBeforeStart and
insertAfterEnd.  For example, if e is the
DIV element, d.insertBeforeStart(e,
"<ul><li>List Item</li></ul>") inserts the list
before the DIV element, and d.insertAfterEnd(e,
"<ul><li>List Item</li></ul>") inserts the list
after the DIV element.  The newly inserted elements
become siblings of the DIV element.

Replacing elements

Elements and all their descendants can be replaced by using the
methods setInnerHTML and setOuterHTML.
For example, if e is the DIV element,
d.setInnerHTML(e, "<ul><li>List
Item</li></ul>") replaces all children paragraphs with
the list, and d.setOuterHTML(e, "<ul><li>List
Item</li></ul>") replaces the DIV element
itself.  In latter case the parent of the list is the
BODY element.

Summary

The following table shows the example document and the results
of various methods described above.



    Example
    insertAfterStart
    insertBeforeEnd
    insertBeforeStart
    insertAfterEnd
    setInnerHTML
    setOuterHTML




        Paragraph 1
        Paragraph 2


insertAfterStart



          List Item

        Paragraph 1
        Paragraph 2


insertBeforeEnd


        Paragraph 1
        Paragraph 2

          List Item



insertBeforeStart


        List Item


        Paragraph 1
        Paragraph 2


insertAfterEnd


        Paragraph 1
        Paragraph 2


        List Item


setInnerHTML



          List Item



setOuterHTML


        List Item





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 JavaBeans™
has been added to the
java.beans package.  Please see XMLEncoder.
raw docstring

javax.swing.text.html.HTMLDocument$Iterator

An iterator to iterate over a particular type of tag. The iterator is not thread safe. If reliable access to the document is not already ensured by the context under which the iterator is being used, its use should be performed under the protection of Document.render.

An iterator to iterate over a particular type of
tag.  The iterator is not thread safe.  If reliable
access to the document is not already ensured by
the context under which the iterator is being used,
its use should be performed under the protection of
Document.render.
raw docstring

javax.swing.text.html.HTMLEditorKit

The Swing JEditorPane text component supports different kinds of content via a plug-in mechanism called an EditorKit. Because HTML is a very popular format of content, some support is provided by default. The default support is provided by this class, which supports HTML version 3.2 (with some extensions), and is migrating toward version 4.0. The <applet> tag is not supported, but some support is provided for the <object> tag.

There are several goals of the HTML EditorKit provided, that have an effect upon the way that HTML is modeled. These have influenced its design in a substantial way.

Support editing

It might seem fairly obvious that a plug-in for JEditorPane should provide editing support, but that fact has several design considerations. There are a substantial number of HTML documents that don't properly conform to an HTML specification. These must be normalized somewhat into a correct form if one is to edit them. Additionally, users don't like to be presented with an excessive amount of structure editing, so using traditional text editing gestures is preferred over using the HTML structure exactly as defined in the HTML document.

The modeling of HTML is provided by the class HTMLDocument. Its documentation describes the details of how the HTML is modeled. The editing support leverages heavily off of the text package.

Extendable/Scalable

To maximize the usefulness of this kit, a great deal of effort has gone into making it extendable. These are some of the features.

The parser is replaceable. The default parser is the Hot Java parser which is DTD based. A different DTD can be used, or an entirely different parser can be used. To change the parser, reimplement the getParser method. The default parser is dynamically loaded when first asked for, so the class files will never be loaded if an alternative parser is used. The default parser is in a separate package called parser below this package.

The parser drives the ParserCallback, which is provided by HTMLDocument. To change the callback, subclass HTMLDocument and reimplement the createDefaultDocument method to return document that produces a different reader. The reader controls how the document is structured. Although the Document provides HTML support by default, there is nothing preventing support of non-HTML tags that result in alternative element structures.

The default view of the models are provided as a hierarchy of View implementations, so one can easily customize how a particular element is displayed or add capabilities for new kinds of elements by providing new View implementations. The default set of views are provided by the HTMLFactory class. This can be easily changed by subclassing or replacing the HTMLFactory and reimplementing the getViewFactory method to return the alternative factory.

The View implementations work primarily off of CSS attributes, which are kept in the views. This makes it possible to have multiple views mapped over the same model that appear substantially different. This can be especially useful for printing. For most HTML attributes, the HTML attributes are converted to CSS attributes for display. This helps make the View implementations more general purpose

Asynchronous Loading

Larger documents involve a lot of parsing and take some time to load. By default, this kit produces documents that will be loaded asynchronously if loaded using JEditorPane.setPage. This is controlled by a property on the document. The method createDefaultDocument can be overriden to change this. The batching of work is done by the HTMLDocument.HTMLReader class. The actual work is done by the DefaultStyledDocument and AbstractDocument classes in the text package.

Customization from current LAF

HTML provides a well known set of features without exactly specifying the display characteristics. Swing has a theme mechanism for its look-and-feel implementations. It is desirable for the look-and-feel to feed display characteristics into the HTML views. An user with poor vision for example would want high contrast and larger than typical fonts.

The support for this is provided by the StyleSheet class. The presentation of the HTML can be heavily influenced by the setting of the StyleSheet property on the EditorKit.

Not lossy

An EditorKit has the ability to be read and save documents. It is generally the most pleasing to users if there is no loss of data between the two operation. The policy of the HTMLEditorKit will be to store things not recognized or not necessarily visible so they can be subsequently written out. The model of the HTML document should therefore contain all information discovered while reading the document. This is constrained in some ways by the need to support editing (i.e. incorrect documents sometimes must be normalized). The guiding principle is that information shouldn't be lost, but some might be synthesized to produce a more correct model or it might be rearranged.

The Swing JEditorPane text component supports different kinds
of content via a plug-in mechanism called an EditorKit.  Because
HTML is a very popular format of content, some support is provided
by default.  The default support is provided by this class, which
supports HTML version 3.2 (with some extensions), and is migrating
toward version 4.0.
The <applet> tag is not supported, but some support is provided
for the <object> tag.

There are several goals of the HTML EditorKit provided, that have
an effect upon the way that HTML is modeled.  These
have influenced its design in a substantial way.


Support editing

It might seem fairly obvious that a plug-in for JEditorPane
should provide editing support, but that fact has several
design considerations.  There are a substantial number of HTML
documents that don't properly conform to an HTML specification.
These must be normalized somewhat into a correct form if one
is to edit them.  Additionally, users don't like to be presented
with an excessive amount of structure editing, so using traditional
text editing gestures is preferred over using the HTML structure
exactly as defined in the HTML document.

The modeling of HTML is provided by the class HTMLDocument.
Its documentation describes the details of how the HTML is modeled.
The editing support leverages heavily off of the text package.


Extendable/Scalable

To maximize the usefulness of this kit, a great deal of effort
has gone into making it extendable.  These are some of the
features.


  The parser is replaceable.  The default parser is the Hot Java
  parser which is DTD based.  A different DTD can be used, or an
  entirely different parser can be used.  To change the parser,
  reimplement the getParser method.  The default parser is
  dynamically loaded when first asked for, so the class files
  will never be loaded if an alternative parser is used.  The
  default parser is in a separate package called parser below
  this package.

  The parser drives the ParserCallback, which is provided by
  HTMLDocument.  To change the callback, subclass HTMLDocument
  and reimplement the createDefaultDocument method to return
  document that produces a different reader.  The reader controls
  how the document is structured.  Although the Document provides
  HTML support by default, there is nothing preventing support of
  non-HTML tags that result in alternative element structures.

  The default view of the models are provided as a hierarchy of
  View implementations, so one can easily customize how a particular
  element is displayed or add capabilities for new kinds of elements
  by providing new View implementations.  The default set of views
  are provided by the HTMLFactory class.  This can
  be easily changed by subclassing or replacing the HTMLFactory
  and reimplementing the getViewFactory method to return the alternative
  factory.

  The View implementations work primarily off of CSS attributes,
  which are kept in the views.  This makes it possible to have
  multiple views mapped over the same model that appear substantially
  different.  This can be especially useful for printing.  For
  most HTML attributes, the HTML attributes are converted to CSS
  attributes for display.  This helps make the View implementations
  more general purpose



Asynchronous Loading

Larger documents involve a lot of parsing and take some time
to load.  By default, this kit produces documents that will be
loaded asynchronously if loaded using JEditorPane.setPage.
This is controlled by a property on the document.  The method
createDefaultDocument can
be overriden to change this.  The batching of work is done
by the HTMLDocument.HTMLReader class.  The actual
work is done by the DefaultStyledDocument and
AbstractDocument classes in the text package.


Customization from current LAF

HTML provides a well known set of features without exactly
specifying the display characteristics.  Swing has a theme
mechanism for its look-and-feel implementations.  It is desirable
for the look-and-feel to feed display characteristics into the
HTML views.  An user with poor vision for example would want
high contrast and larger than typical fonts.

The support for this is provided by the StyleSheet
class.  The presentation of the HTML can be heavily influenced
by the setting of the StyleSheet property on the EditorKit.


Not lossy

An EditorKit has the ability to be read and save documents.
It is generally the most pleasing to users if there is no loss
of data between the two operation.  The policy of the HTMLEditorKit
will be to store things not recognized or not necessarily visible
so they can be subsequently written out.  The model of the HTML document
should therefore contain all information discovered while reading the
document.  This is constrained in some ways by the need to support
editing (i.e. incorrect documents sometimes must be normalized).
The guiding principle is that information shouldn't be lost, but
some might be synthesized to produce a more correct model or it might
be rearranged.
raw docstring

javax.swing.text.html.HTMLEditorKit$HTMLFactory

A factory to build views for HTML. The following table describes what this factory will build by default.

TagView created

HTML.Tag.CONTENTInlineView

HTML.Tag.IMPLIEDjavax.swing.text.html.ParagraphView

HTML.Tag.Pjavax.swing.text.html.ParagraphView

HTML.Tag.H1javax.swing.text.html.ParagraphView

HTML.Tag.H2javax.swing.text.html.ParagraphView

HTML.Tag.H3javax.swing.text.html.ParagraphView

HTML.Tag.H4javax.swing.text.html.ParagraphView

HTML.Tag.H5javax.swing.text.html.ParagraphView

HTML.Tag.H6javax.swing.text.html.ParagraphView

HTML.Tag.DTjavax.swing.text.html.ParagraphView

HTML.Tag.MENUListView

HTML.Tag.DIRListView

HTML.Tag.ULListView

HTML.Tag.OLListView

HTML.Tag.LIBlockView

HTML.Tag.DLBlockView

HTML.Tag.DDBlockView

HTML.Tag.BODYBlockView

HTML.Tag.HTMLBlockView

HTML.Tag.CENTERBlockView

HTML.Tag.DIVBlockView

HTML.Tag.BLOCKQUOTEBlockView

HTML.Tag.PREBlockView

HTML.Tag.BLOCKQUOTEBlockView

HTML.Tag.PREBlockView

HTML.Tag.IMGImageView

HTML.Tag.HRHRuleView

HTML.Tag.BRBRView

HTML.Tag.TABLEjavax.swing.text.html.TableView

HTML.Tag.INPUTFormView

HTML.Tag.SELECTFormView

HTML.Tag.TEXTAREAFormView

HTML.Tag.OBJECTObjectView

HTML.Tag.FRAMESETFrameSetView

HTML.Tag.FRAMEFrameView

A factory to build views for HTML.  The following
table describes what this factory will build by
default.



TagView created

HTML.Tag.CONTENTInlineView

HTML.Tag.IMPLIEDjavax.swing.text.html.ParagraphView

HTML.Tag.Pjavax.swing.text.html.ParagraphView

HTML.Tag.H1javax.swing.text.html.ParagraphView

HTML.Tag.H2javax.swing.text.html.ParagraphView

HTML.Tag.H3javax.swing.text.html.ParagraphView

HTML.Tag.H4javax.swing.text.html.ParagraphView

HTML.Tag.H5javax.swing.text.html.ParagraphView

HTML.Tag.H6javax.swing.text.html.ParagraphView

HTML.Tag.DTjavax.swing.text.html.ParagraphView

HTML.Tag.MENUListView

HTML.Tag.DIRListView

HTML.Tag.ULListView

HTML.Tag.OLListView

HTML.Tag.LIBlockView

HTML.Tag.DLBlockView

HTML.Tag.DDBlockView

HTML.Tag.BODYBlockView

HTML.Tag.HTMLBlockView

HTML.Tag.CENTERBlockView

HTML.Tag.DIVBlockView

HTML.Tag.BLOCKQUOTEBlockView

HTML.Tag.PREBlockView

HTML.Tag.BLOCKQUOTEBlockView

HTML.Tag.PREBlockView

HTML.Tag.IMGImageView

HTML.Tag.HRHRuleView

HTML.Tag.BRBRView

HTML.Tag.TABLEjavax.swing.text.html.TableView

HTML.Tag.INPUTFormView

HTML.Tag.SELECTFormView

HTML.Tag.TEXTAREAFormView

HTML.Tag.OBJECTObjectView

HTML.Tag.FRAMESETFrameSetView

HTML.Tag.FRAMEFrameView
raw docstring

javax.swing.text.html.HTMLEditorKit$HTMLTextAction

An abstract Action providing some convenience methods that may be useful in inserting HTML into an existing document. NOTE: None of the convenience methods obtain a lock on the document. If you have another thread modifying the text these methods may have inconsistent behavior, or return the wrong thing.

An abstract Action providing some convenience methods that may
be useful in inserting HTML into an existing document.
NOTE: None of the convenience methods obtain a lock on the
document. If you have another thread modifying the text these
methods may have inconsistent behavior, or return the wrong thing.
raw docstring

javax.swing.text.html.HTMLEditorKit$InsertHTMLTextAction

InsertHTMLTextAction can be used to insert an arbitrary string of HTML into an existing HTML document. At least two HTML.Tags need to be supplied. The first Tag, parentTag, identifies the parent in the document to add the elements to. The second tag, addTag, identifies the first tag that should be added to the document as seen in the HTML string. One important thing to remember, is that the parser is going to generate all the appropriate tags, even if they aren't in the HTML string passed in. For example, lets say you wanted to create an action to insert a table into the body. The parentTag would be HTML.Tag.BODY, addTag would be HTML.Tag.TABLE, and the string could be something like <table><tr><td></td></tr></table>. There is also an option to supply an alternate parentTag and addTag. These will be checked for if there is no parentTag at offset.

InsertHTMLTextAction can be used to insert an arbitrary string of HTML
into an existing HTML document. At least two HTML.Tags need to be
supplied. The first Tag, parentTag, identifies the parent in
the document to add the elements to. The second tag, addTag,
identifies the first tag that should be added to the document as
seen in the HTML string. One important thing to remember, is that
the parser is going to generate all the appropriate tags, even if
they aren't in the HTML string passed in.
For example, lets say you wanted to create an action to insert
a table into the body. The parentTag would be HTML.Tag.BODY,
addTag would be HTML.Tag.TABLE, and the string could be something
like <table><tr><td></td></tr></table>.
There is also an option to supply an alternate parentTag and
addTag. These will be checked for if there is no parentTag at
offset.
raw docstring

javax.swing.text.html.HTMLEditorKit$LinkController

Class to watch the associated component and fire hyperlink events on it when appropriate.

Class to watch the associated component and fire
hyperlink events on it when appropriate.
raw docstring

javax.swing.text.html.HTMLEditorKit$Parser

Interface to be supported by the parser. This enables providing a different parser while reusing some of the implementation provided by this editor kit.

Interface to be supported by the parser.  This enables
providing a different parser while reusing some of the
implementation provided by this editor kit.
raw docstring

javax.swing.text.html.HTMLEditorKit$ParserCallback

The result of parsing drives these callback methods. The open and close actions should be balanced. The flush method will be the last method called, to give the receiver a chance to flush any pending data into the document. Refer to DocumentParser, the default parser used, for further information on the contents of the AttributeSets, the positions, and other info.

The result of parsing drives these callback methods.
The open and close actions should be balanced.  The
flush method will be the last method
called, to give the receiver a chance to flush any
pending data into the document.
Refer to DocumentParser, the default parser used, for further
information on the contents of the AttributeSets, the positions, and
other info.
raw docstring

javax.swing.text.html.HTMLFrameHyperlinkEvent

HTMLFrameHyperlinkEvent is used to notify interested parties that link was activated in a frame.

HTMLFrameHyperlinkEvent is used to notify interested
parties that link was activated in a frame.
raw docstring

javax.swing.text.html.HTMLWriter

This is a writer for HTMLDocuments.

This is a writer for HTMLDocuments.
raw docstring

javax.swing.text.html.ImageView

View of an Image, intended to support the HTML <IMG> tag. Supports scaling via the HEIGHT and WIDTH attributes of the tag. If the image is unable to be loaded any text specified via the ALT attribute will be rendered.

While this class has been part of swing for a while now, it is public as of 1.4.

View of an Image, intended to support the HTML <IMG> tag.
Supports scaling via the HEIGHT and WIDTH attributes of the tag.
If the image is unable to be loaded any text specified via the
ALT attribute will be rendered.

While this class has been part of swing for a while now, it is public
as of 1.4.
raw docstring

javax.swing.text.html.InlineView

Displays the inline element styles based upon css attributes.

Displays the inline element styles
based upon css attributes.
raw docstring

javax.swing.text.html.ListView

A view implementation to display an html list

A view implementation to display an html list
raw docstring

javax.swing.text.html.MinimalHTMLWriter

MinimalHTMLWriter is a fallback writer used by the HTMLEditorKit to write out HTML for a document that is a not produced by the EditorKit.

The format for the document is:

<html> <head> <style> <!-- list of named styles p.normal { font-family: SansSerif; margin-height: 0; font-size: 14 } --> </style> </head> <body> <p style=normal> Bold, italic, and underline attributes of the run are emitted as HTML tags. The remaining attributes are emitted as part of the style attribute of a <span> tag. The syntax is similar to inline styles. </p> </body> </html>

MinimalHTMLWriter is a fallback writer used by the
HTMLEditorKit to write out HTML for a document that
is a not produced by the EditorKit.

The format for the document is:


<html>
  <head>
    <style>
       <!-- list of named styles
        p.normal {
           font-family: SansSerif;
           margin-height: 0;
           font-size: 14
        }
       -->
     </style>
  </head>
  <body>
   <p style=normal>
       Bold, italic, and underline attributes
       of the run are emitted as HTML tags.
       The remaining attributes are emitted as
       part of the style attribute of a <span> tag.
       The syntax is similar to inline styles.
   </p>
  </body>
</html>
raw docstring

javax.swing.text.html.ObjectView

Component decorator that implements the view interface for <object> elements.

This view will try to load the class specified by the classid attribute. If possible, the Classloader used to load the associated Document is used. This would typically be the same as the ClassLoader used to load the EditorKit. If the document's ClassLoader is null, Class.forName is used.

If the class can successfully be loaded, an attempt will be made to create an instance of it by calling Class.newInstance. An attempt will be made to narrow the instance to type java.awt.Component to display the object.

This view can also manage a set of parameters with limitations. The parameters to the <object> element are expected to be present on the associated elements attribute set as simple strings. Each bean property will be queried as a key on the AttributeSet, with the expectation that a non-null value (of type String) will be present if there was a parameter specification for the property. Reflection is used to set the parameter. Currently, this is limited to a very simple single parameter of type String.

A simple example HTML invocation is:

 <object classid="javax.swing.JLabel">
 <param name="text" value="sample text">
 </object>
Component decorator that implements the view interface
for <object> elements.

This view will try to load the class specified by the
classid attribute.  If possible, the Classloader
used to load the associated Document is used.
This would typically be the same as the ClassLoader
used to load the EditorKit.  If the document's
ClassLoader is null, Class.forName is used.

If the class can successfully be loaded, an attempt will
be made to create an instance of it by calling
Class.newInstance.  An attempt will be made
to narrow the instance to type java.awt.Component
to display the object.

This view can also manage a set of parameters with limitations.
The parameters to the <object> element are expected to
be present on the associated elements attribute set as simple
strings.  Each bean property will be queried as a key on
the AttributeSet, with the expectation that a non-null value
(of type String) will be present if there was a parameter
specification for the property.  Reflection is used to
set the parameter.  Currently, this is limited to a very
simple single parameter of type String.

A simple example HTML invocation is:


     <object classid="javax.swing.JLabel">
     <param name="text" value="sample text">
     </object>
raw docstring

javax.swing.text.html.Option

Value for the ListModel used to represent

<option> elements. This is the object installed as items of the DefaultComboBoxModel used to represent the <select> element.

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 JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Value for the ListModel used to represent
<option> elements.  This is the object
installed as items of the DefaultComboBoxModel
used to represent the <select> element.

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 JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.html.ParagraphView

Displays the a paragraph, and uses css attributes for its configuration.

Displays the a paragraph, and uses css attributes for its
configuration.
raw docstring

javax.swing.text.html.parser.AttributeList

This class defines the attributes of an SGML element as described in a DTD using the ATTLIST construct. An AttributeList can be obtained from the Element class using the getAttributes() method.

It is actually an element in a linked list. Use the getNext() method repeatedly to enumerate all the attributes of an element.

This class defines the attributes of an SGML element
as described in a DTD using the ATTLIST construct.
An AttributeList can be obtained from the Element
class using the getAttributes() method.

It is actually an element in a linked list. Use the
getNext() method repeatedly to enumerate all the attributes
of an element.
raw docstring

javax.swing.text.html.parser.ContentModel

A representation of a content model. A content model is basically a restricted BNF expression. It is restricted in the sense that it must be deterministic. This means that you don't have to represent it as a finite state automaton. See Annex H on page 556 of the SGML handbook for more information.

A representation of a content model. A content model is
basically a restricted BNF expression. It is restricted in
the sense that it must be deterministic. This means that you
don't have to represent it as a finite state automaton.
See Annex H on page 556 of the SGML handbook for more information.
raw docstring

javax.swing.text.html.parser.core

No vars found in this namespace.

javax.swing.text.html.parser.DocumentParser

A Parser for HTML Documents (actually, you can specify a DTD, but you should really only use this class with the html dtd in swing). Reads an InputStream of HTML and invokes the appropriate methods in the ParserCallback class. This is the default parser used by HTMLEditorKit to parse HTML url's. This will message the callback for all valid tags, as well as tags that are implied but not explicitly specified. For example, the html string (<p>blah) only has a p tag defined. The callback will see the following methods: handleStartTag(html, ...) handleStartTag(head, ...) handleEndTag(head) handleStartTag(body, ...) handleStartTag(p, ...) handleText(...) handleEndTag(p) handleEndTag(body) handleEndTag(html)

The items in italic are implied, that is, although they were not explicitly specified, to be correct html they should have been present (head isn't necessary, but it is still generated). For tags that are implied, the AttributeSet argument will have a value of Boolean.TRUE for the key HTMLEditorKit.ParserCallback.IMPLIED. HTML.Attributes defines a type safe enumeration of html attributes. If an attribute key of a tag is defined in HTML.Attribute, the HTML.Attribute will be used as the key, otherwise a String will be used. For example <p foo=bar class=neat> has two attributes. foo is not defined in HTML.Attribute, where as class is, therefore the AttributeSet will have two values in it, HTML.Attribute.CLASS with a String value of 'neat' and the String key 'foo' with a String value of 'bar'. The position argument will indicate the start of the tag, comment or text. Similar to arrays, the first character in the stream has a position of 0. For tags that are implied the position will indicate the location of the next encountered tag. In the first example, the implied start body and html tags will have the same position as the p tag, and the implied end p, html and body tags will all have the same position. As html skips whitespace the position for text will be the position of the first valid character, eg in the string '\n\n\nblah' the text 'blah' will have a position of 3, the newlines are skipped.

For attributes that do not have a value, eg in the html string <foo blah> the attribute blah does not have a value, there are two possible values that will be placed in the AttributeSet's value:

If the DTD does not contain an definition for the element, or the definition does not have an explicit value then the value in the AttributeSet will be HTML.NULL_ATTRIBUTE_VALUE. If the DTD contains an explicit value, as in: <!ATTLIST OPTION selected (selected) #IMPLIED> this value from the dtd (in this case selected) will be used.

Once the stream has been parsed, the callback is notified of the most likely end of line string. The end of line string will be one of \n, \r or \r\n, which ever is encountered the most in parsing the stream.

A Parser for HTML Documents (actually, you can specify a DTD, but
you should really only use this class with the html dtd in swing).
Reads an InputStream of HTML and
invokes the appropriate methods in the ParserCallback class. This
is the default parser used by HTMLEditorKit to parse HTML url's.
This will message the callback for all valid tags, as well as
tags that are implied but not explicitly specified. For example, the
html string (<p>blah) only has a p tag defined. The callback
will see the following methods:
handleStartTag(html, ...)
    handleStartTag(head, ...)
    handleEndTag(head)
    handleStartTag(body, ...)
    handleStartTag(p, ...)
    handleText(...)
    handleEndTag(p)
    handleEndTag(body)
    handleEndTag(html)

The items in italic are implied, that is, although they were not
explicitly specified, to be correct html they should have been present
(head isn't necessary, but it is still generated). For tags that
are implied, the AttributeSet argument will have a value of
Boolean.TRUE for the key
HTMLEditorKit.ParserCallback.IMPLIED.
HTML.Attributes defines a type safe enumeration of html attributes.
If an attribute key of a tag is defined in HTML.Attribute, the
HTML.Attribute will be used as the key, otherwise a String will be used.
For example <p foo=bar class=neat> has two attributes. foo is
not defined in HTML.Attribute, where as class is, therefore the
AttributeSet will have two values in it, HTML.Attribute.CLASS with
a String value of 'neat' and the String key 'foo' with a String value of
'bar'.
The position argument will indicate the start of the tag, comment
or text. Similar to arrays, the first character in the stream has a
position of 0. For tags that are
implied the position will indicate
the location of the next encountered tag. In the first example,
the implied start body and html tags will have the same position as the
p tag, and the implied end p, html and body tags will all have the same
position.
As html skips whitespace the position for text will be the position
of the first valid character, eg in the string '\n\n\nblah'
the text 'blah' will have a position of 3, the newlines are skipped.

For attributes that do not have a value, eg in the html
string <foo blah> the attribute blah
does not have a value, there are two possible values that will be
placed in the AttributeSet's value:

If the DTD does not contain an definition for the element, or the
    definition does not have an explicit value then the value in the
    AttributeSet will be HTML.NULL_ATTRIBUTE_VALUE.
If the DTD contains an explicit value, as in:
    <!ATTLIST OPTION selected (selected) #IMPLIED>
    this value from the dtd (in this case selected) will be used.


Once the stream has been parsed, the callback is notified of the most
likely end of line string. The end of line string will be one of
\n, \r or \r\n, which ever is encountered the most in parsing the
stream.
raw docstring

javax.swing.text.html.parser.DTD

The representation of an SGML DTD. DTD describes a document syntax and is used in parsing of HTML documents. It contains a list of elements and their attributes as well as a list of entities defined in the DTD.

The representation of an SGML DTD.  DTD describes a document
syntax and is used in parsing of HTML documents.  It contains
a list of elements and their attributes as well as a list of
entities defined in the DTD.
raw docstring

javax.swing.text.html.parser.DTDConstants

SGML constants used in a DTD. The names of the constants correspond the the equivalent SGML constructs as described in "The SGML Handbook" by Charles F. Goldfarb.

SGML constants used in a DTD. The names of the
constants correspond the the equivalent SGML constructs
as described in "The SGML Handbook" by  Charles F. Goldfarb.
raw docstring

No vars found in this namespace.

javax.swing.text.html.parser.Element

An element as described in a DTD using the ELEMENT construct. This is essential the description of a tag. It describes the type, content model, attributes, attribute types etc. It is used to correctly parse a document by the Parser.

An element as described in a DTD using the ELEMENT construct.
This is essential the description of a tag. It describes the
type, content model, attributes, attribute types etc. It is used
to correctly parse a document by the Parser.
raw docstring

javax.swing.text.html.parser.Entity

An entity is described in a DTD using the ENTITY construct. It defines the type and value of the the entity.

An entity is described in a DTD using the ENTITY construct.
It defines the type and value of the the entity.
raw docstring

javax.swing.text.html.parser.Parser

A simple DTD-driven HTML parser. The parser reads an HTML file from an InputStream and calls various methods (which should be overridden in a subclass) when tags and data are encountered.

Unfortunately there are many badly implemented HTML parsers out there, and as a result there are many badly formatted HTML files. This parser attempts to parse most HTML files. This means that the implementation sometimes deviates from the SGML specification in favor of HTML.

The parser treats \r and \r\n as \n. Newlines after starttags and before end tags are ignored just as specified in the SGML/HTML specification.

The html spec does not specify how spaces are to be coalesced very well. Specifically, the following scenarios are not discussed (note that a space should be used here, but I am using &nbsp to force the space to be displayed):

'<b>blah <i> <strike> foo' which can be treated as: '<b>blah <i><strike>foo' as well as: '<p><a href="xx"> <em>Using</em></a></p>' which appears to be treated as: '<p><a href="xx"><em>Using</em></a></p>'

If strict is false, when a tag that breaks flow, (TagElement.breaksFlows) or trailing whitespace is encountered, all whitespace will be ignored until a non whitespace character is encountered. This appears to give behavior closer to the popular browsers.

A simple DTD-driven HTML parser. The parser reads an
HTML file from an InputStream and calls various methods
(which should be overridden in a subclass) when tags and
data are encountered.

Unfortunately there are many badly implemented HTML parsers
out there, and as a result there are many badly formatted
HTML files. This parser attempts to parse most HTML files.
This means that the implementation sometimes deviates from
the SGML specification in favor of HTML.

The parser treats \r and \r\n as \n. Newlines after starttags
and before end tags are ignored just as specified in the SGML/HTML
specification.

The html spec does not specify how spaces are to be coalesced very well.
Specifically, the following scenarios are not discussed (note that a
space should be used here, but I am using &nbsp to force the space to
be displayed):

'<b>blah <i> <strike> foo' which can be treated as:
'<b>blah <i><strike>foo'
as well as:
'<p><a href="xx"> <em>Using</em></a></p>'
which appears to be treated as:
'<p><a href="xx"><em>Using</em></a></p>'

If strict is false, when a tag that breaks flow,
(TagElement.breaksFlows) or trailing whitespace is
encountered, all whitespace will be ignored until a non whitespace
character is encountered. This appears to give behavior closer to
the popular browsers.
raw docstring

javax.swing.text.html.parser.ParserDelegator

Responsible for starting up a new DocumentParser each time its parse method is invoked. Stores a reference to the dtd.

Responsible for starting up a new DocumentParser
each time its parse method is invoked. Stores a
reference to the dtd.
raw docstring

javax.swing.text.html.parser.TagElement

A generic HTML TagElement class. The methods define how white space is interpreted around the tag.

A generic HTML TagElement class. The methods define how white
space is interpreted around the tag.
raw docstring

javax.swing.text.html.StyleSheet

Support for defining the visual characteristics of HTML views being rendered. The StyleSheet is used to translate the HTML model into visual characteristics. This enables views to be customized by a look-and-feel, multiple views over the same model can be rendered differently, etc. This can be thought of as a CSS rule repository. The key for CSS attributes is an object of type CSS.Attribute. The type of the value is up to the StyleSheet implementation, but the toString method is required to return a string representation of CSS value.

The primary entry point for HTML View implementations to get their attributes is the getViewAttributes method. This should be implemented to establish the desired policy used to associate attributes with the view. Each HTMLEditorKit (i.e. and therefore each associated JEditorPane) can have its own StyleSheet, but by default one sheet will be shared by all of the HTMLEditorKit instances. HTMLDocument instance can also have a StyleSheet, which holds the document-specific CSS specifications.

In order for Views to store less state and therefore be more lightweight, the StyleSheet can act as a factory for painters that handle some of the rendering tasks. This allows implementations to determine what they want to cache and have the sharing potentially at the level that a selector is common to multiple views. Since the StyleSheet may be used by views over multiple documents and typically the HTML attributes don't effect the selector being used, the potential for sharing is significant.

The rules are stored as named styles, and other information is stored to translate the context of an element to a rule quickly. The following code fragment will display the named styles, and therefore the CSS rules contained.

import java.util.; import javax.swing.text.; import javax.swing.text.html.*;

public class ShowStyles {

  public static void main(String[] args) {
    HTMLEditorKit kit = new HTMLEditorKit();
    HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();
    StyleSheet styles = doc.getStyleSheet();

    Enumeration rules = styles.getStyleNames();
    while (rules.hasMoreElements()) {
        String name = (String) rules.nextElement();
        Style rule = styles.getStyle(name);
        System.out.println(rule.toString());
    }
    System.exit(0);
  }

}

The semantics for when a CSS style should overide visual attributes defined by an element are not well defined. For example, the html

<body bgcolor=red> makes the body have a red background. But if the html file also contains the CSS rule body { background: blue } it becomes less clear as to what color the background of the body should be. The current implementation gives visual attributes defined in the element the highest precedence, that is they are always checked before any styles. Therefore, in the previous example the background would have a red color as the body element defines the background color to be red.

As already mentioned this supports CSS. We don't support the full CSS spec. Refer to the javadoc of the CSS class to see what properties we support. The two major CSS parsing related concepts we do not currently support are pseudo selectors, such as A:link { color: red }, and the important modifier.

Note: This implementation is currently incomplete. It can be replaced with alternative implementations that are complete. Future versions of this class will provide better CSS support.

Support for defining the visual characteristics of
HTML views being rendered.  The StyleSheet is used to
translate the HTML model into visual characteristics.
This enables views to be customized by a look-and-feel,
multiple views over the same model can be rendered
differently, etc.  This can be thought of as a CSS
rule repository.  The key for CSS attributes is an
object of type CSS.Attribute.  The type of the value
is up to the StyleSheet implementation, but the
toString method is required
to return a string representation of CSS value.

The primary entry point for HTML View implementations
to get their attributes is the
getViewAttributes
method.  This should be implemented to establish the
desired policy used to associate attributes with the view.
Each HTMLEditorKit (i.e. and therefore each associated
JEditorPane) can have its own StyleSheet, but by default one
sheet will be shared by all of the HTMLEditorKit instances.
HTMLDocument instance can also have a StyleSheet, which
holds the document-specific CSS specifications.

In order for Views to store less state and therefore be
more lightweight, the StyleSheet can act as a factory for
painters that handle some of the rendering tasks.  This allows
implementations to determine what they want to cache
and have the sharing potentially at the level that a
selector is common to multiple views.  Since the StyleSheet
may be used by views over multiple documents and typically
the HTML attributes don't effect the selector being used,
the potential for sharing is significant.

The rules are stored as named styles, and other information
is stored to translate the context of an element to a
rule quickly.  The following code fragment will display
the named styles, and therefore the CSS rules contained.


  import java.util.*;
  import javax.swing.text.*;
  import javax.swing.text.html.*;

  public class ShowStyles {

      public static void main(String[] args) {
        HTMLEditorKit kit = new HTMLEditorKit();
        HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();
        StyleSheet styles = doc.getStyleSheet();

        Enumeration rules = styles.getStyleNames();
        while (rules.hasMoreElements()) {
            String name = (String) rules.nextElement();
            Style rule = styles.getStyle(name);
            System.out.println(rule.toString());
        }
        System.exit(0);
      }
  }

The semantics for when a CSS style should overide visual attributes
defined by an element are not well defined. For example, the html
<body bgcolor=red> makes the body have a red
background. But if the html file also contains the CSS rule
body { background: blue } it becomes less clear as to
what color the background of the body should be. The current
implementation gives visual attributes defined in the element the
highest precedence, that is they are always checked before any styles.
Therefore, in the previous example the background would have a
red color as the body element defines the background color to be red.

As already mentioned this supports CSS. We don't support the full CSS
spec. Refer to the javadoc of the CSS class to see what properties
we support. The two major CSS parsing related
concepts we do not currently
support are pseudo selectors, such as A:link { color: red },
and the important modifier.

Note: This implementation is currently
incomplete.  It can be replaced with alternative implementations
that are complete.  Future versions of this class will provide
better CSS support.
raw docstring

javax.swing.text.html.StyleSheet$BoxPainter

Class to carry out some of the duties of CSS formatting. Implementations of this class enable views to present the CSS formatting while not knowing anything about how the CSS values are being cached.

As a delegate of Views, this object is responsible for the insets of a View and making sure the background is maintained according to the CSS attributes.

Class to carry out some of the duties of
CSS formatting.  Implementations of this
class enable views to present the CSS formatting
while not knowing anything about how the CSS values
are being cached.

As a delegate of Views, this object is responsible for
the insets of a View and making sure the background
is maintained according to the CSS attributes.
raw docstring

javax.swing.text.html.StyleSheet$ListPainter

Class to carry out some of the duties of CSS list formatting. Implementations of this class enable views to present the CSS formatting while not knowing anything about how the CSS values are being cached.

Class to carry out some of the duties of CSS list
formatting.  Implementations of this
class enable views to present the CSS formatting
while not knowing anything about how the CSS values
are being cached.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close