| java.lang.Object | ||
| ↳ | javax.swing.text.AbstractWriter | |
| ↳ | 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>
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
javax.swing.text.AbstractWriter
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new MinimalHTMLWriter.
| |||||||||||
Creates a new MinimalHTMLWriter.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Generates HTML output
from a StyledDocument.
| |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
This is no longer used, instead <span> will be written out.
| |||||||||||
Returns true if we are currently in a <font> tag.
| |||||||||||
Returns true if the element is a text element.
| |||||||||||
This is no longer used, instead <span> will be written out.
| |||||||||||
Writes out text.
| |||||||||||
Writes out all the attributes for the
following types:
StyleConstants.ParagraphConstants,
StyleConstants.CharacterConstants,
StyleConstants.FontConstants,
StyleConstants.ColorConstants.
| |||||||||||
Iterates over the elements in the document
and processes elements based on whether they are
branch elements or leaf elements.
| |||||||||||
Responsible for handling Component Elements;
deliberately unimplemented.
| |||||||||||
Writes out the attribute set
in an HTML-compliant manner.
| |||||||||||
Emits an end tag for a <p>
tag.
| |||||||||||
Writes out an end tag appropriately
indented.
| |||||||||||
Generates
bold <b>, italic <i>, and <u> tags for the
text based on its attribute settings.
| |||||||||||
Writes out the <head> and <style>
tags, and then invokes writeStyles() to write
out all the named styles as the content of the
<style> tag.
| |||||||||||
Responsible for handling Icon Elements;
deliberately unimplemented.
| |||||||||||
Responsible for writing out other non-text leaf
elements.
| |||||||||||
Writes out the remaining
character-level attributes (attributes other than bold,
italic, and underline) in an HTML-compliant way.
| |||||||||||
Emits the start tag for a paragraph.
| |||||||||||
Writes out a start tag appropriately
indented.
| |||||||||||
Writes out all the named styles as the
content of the <style> tag.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
javax.swing.text.AbstractWriter
| |||||||||||
From class
java.lang.Object
| |||||||||||
Creates a new MinimalHTMLWriter.
| w | Writer |
|---|---|
| doc | StyledDocument |
Creates a new MinimalHTMLWriter.
| w | Writer |
|---|---|
| doc | StyledDocument |
| pos | The location in the document to fetch the content. |
| len | The amount to write out. |
Generates HTML output from a StyledDocument.
| IOException | on any I/O error |
|---|---|
| BadLocationException | if pos represents an invalid location within the document. |
This is no longer used, instead <span> will be written out.
Writes out an end tag for the <font> tag.
| IOException | on any I/O error |
|---|
Returns true if we are currently in a <font> tag.
This is no longer used, instead <span> will be written out.
Writes out a start tag for the <font> tag. Because font tags cannot be nested, this method closes out any enclosing font tag before writing out a new start tag.
| IOException | on any I/O error |
|---|
Writes out text.
| elem | an Element. |
|---|
| IOException | on any I/O error |
|---|---|
| BadLocationException |
Writes out all the attributes for the following types: StyleConstants.ParagraphConstants, StyleConstants.CharacterConstants, StyleConstants.FontConstants, StyleConstants.ColorConstants. The attribute name and value are separated by a colon. Each pair is separated by a semicolon.
| attr | an AttributeSet. |
|---|
| IOException | on any I/O error |
|---|
Iterates over the elements in the document and processes elements based on whether they are branch elements or leaf elements. This method specially handles leaf elements that are text.
| IOException | on any I/O error |
|---|---|
| BadLocationException |
Responsible for handling Component Elements; deliberately unimplemented. How this method is implemented is a matter of policy.
| IOException |
|---|
Writes out the attribute set in an HTML-compliant manner.
| IOException | on any I/O error |
|---|---|
| BadLocationException | if pos represents an invalid location within the document. |
Emits an end tag for a <p> tag. Before writing out the tag, this method ensures that all other tags that have been opened are appropriately closed off.
| IOException | on any I/O error |
|---|
Writes out an end tag appropriately indented. Also decrements the indent level.
| IOException | on any I/O error |
|---|
Generates bold <b>, italic <i>, and <u> tags for the text based on its attribute settings.
| IOException | on any I/O error |
|---|
Writes out the <head> and <style> tags, and then invokes writeStyles() to write out all the named styles as the content of the <style> tag. The content is surrounded by valid HTML comment markers to ensure that the document is viewable in applications/browsers that do not support the tag.
| IOException | on any I/O error |
|---|
Responsible for handling Icon Elements; deliberately unimplemented. How to implement this method is an issue of policy. For example, if you're generating an <img> tag, how should you represent the src attribute (the location of the image)? In certain cases it could be a URL, in others it could be read from a stream.
| elem | element of type StyleConstants.IconElementName |
|---|
| IOException |
|---|
Responsible for writing out other non-text leaf elements.
| IOException | on any I/O error |
|---|
Writes out the remaining character-level attributes (attributes other than bold, italic, and underline) in an HTML-compliant way. Given that attributes such as font family and font size have no direct mapping to HTML tags, a <span> tag is generated and its style attribute is set to contain the list of remaining attributes just like inline styles.
| IOException | on any I/O error |
|---|
Emits the start tag for a paragraph. If the paragraph has a named style associated with it, then this method also generates a class attribute for the <p> tag and sets its value to be the name of the style.
| IOException | on any I/O error |
|---|
Writes out a start tag appropriately indented. Also increments the indent level.
| IOException | on any I/O error |
|---|
Writes out all the named styles as the content of the <style> tag.
| IOException | on any I/O error |
|---|