|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.swing.text.AbstractWriter
javax.swing.text.html.MinimalHTMLWriter
public class MinimalHTMLWriter
MinimalHTMLWriter 是一个回退 writer,HTMLEditorKit 使用它为非 EditorKit 生成的文档写出 HTML。 文档的格式为:
<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>
| 字段摘要 |
|---|
| 从类 javax.swing.text.AbstractWriter 继承的字段 |
|---|
NEWLINE |
| 构造方法摘要 | |
|---|---|
MinimalHTMLWriter(Writer w,
StyledDocument doc)
创建一个新的 MinimalHTMLWriter。 |
|
MinimalHTMLWriter(Writer w,
StyledDocument doc,
int pos,
int len)
创建一个新的 MinimalHTMLWriter。 |
|
| 方法摘要 | |
|---|---|
protected void |
endFontTag()
此方法已不再使用,而用写出 <span> 来替换。 |
protected boolean |
inFontTag()
如果我们当前正处在 <font> 标记中,则返回 true。 |
protected boolean |
isText(Element elem)
如果元素是文本元素,则返回 true。 |
protected void |
startFontTag(String style)
此方法已不再使用,而用写出 <span> 来替换。 |
protected void |
text(Element elem)
写出文本。 |
void |
write()
从 StyledDocument 生成 HTML 输出。 |
protected void |
writeAttributes(AttributeSet attr)
写出以下类型的所有属性:StyleConstants.ParagraphConstants、StyleConstants.CharacterConstants、StyleConstants.FontConstants、StyleConstants.ColorConstants。 |
protected void |
writeBody()
对文档中的元素进行迭代,并基于元素是分支元素还是叶元素来处理它们。 |
protected void |
writeComponent(Element elem)
负责处理 Component Elements;有意不实现它。 |
protected void |
writeContent(Element elem,
boolean needsIndenting)
以与 HTML 兼容的方式写出属性集。 |
protected void |
writeEndParagraph()
发出 <p> 标记的结束标记。 |
protected void |
writeEndTag(String endTag)
写出适当缩进的结束标记。 |
protected void |
writeHeader()
写出 <head> 和 <style> 标记,然后调用 writeStyles(),以写出所有命名的样式,这些样式作为 <style> 标记的内容。 |
protected void |
writeHTMLTags(AttributeSet attr)
基于文本的属性设置生成文本的 bold <b>、italic <i> 和 <u> 标记。 |
protected void |
writeImage(Element elem)
负责处理 Icon Elements;有意不实现它。 |
protected void |
writeLeaf(Element elem)
负责写出其他非文本叶元素。 |
protected void |
writeNonHTMLAttributes(AttributeSet attr)
以与 HTML 兼容的方式写出其余的字符级属性(bold、italic 和 underline 之外的属性)。 |
protected void |
writeStartParagraph(Element elem)
发出段落的开始标记。 |
protected void |
writeStartTag(String tag)
写出适当缩进的开始标记。 |
protected void |
writeStyles()
写出所有命名的样式,这些样式作为 <style> 标记的内容。 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public MinimalHTMLWriter(Writer w,
StyledDocument doc)
w - Writerdoc - StyledDocument
public MinimalHTMLWriter(Writer w,
StyledDocument doc,
int pos,
int len)
w - Writerdoc - StyledDocumentpos - 文档中要获取内容的位置。len - 写出量。| 方法详细信息 |
|---|
public void write()
throws IOException,
BadLocationException
AbstractWriter 中的 writeIOException - 如果发生任何 I/O 错误
BadLocationException - 如果 pos 表示文档中的一个无效位置
protected void writeAttributes(AttributeSet attr)
throws IOException
AbstractWriter 中的 writeAttributesattr - AttributeSet。
IOException - 如果发生任何 I/O 错误
protected void text(Element elem)
throws IOException,
BadLocationException
AbstractWriter 中的 textelem - Element。
IOException - 如果发生任何 I/O 错误
BadLocationException - 如果 pos 表示文档中的一个无效位置
protected void writeStartTag(String tag)
throws IOException
IOException - 如果发生任何 I/O 错误
protected void writeEndTag(String endTag)
throws IOException
IOException - 如果发生任何 I/O 错误
protected void writeHeader()
throws IOException
IOException - 如果发生任何 I/O 错误
protected void writeStyles()
throws IOException
IOException - 如果发生任何 I/O 错误
protected void writeBody()
throws IOException,
BadLocationException
IOException - 如果发生任何 I/O 错误
BadLocationException
protected void writeEndParagraph()
throws IOException
IOException - 如果发生任何 I/O 错误
protected void writeStartParagraph(Element elem)
throws IOException
IOException - 如果发生任何 I/O 错误
protected void writeLeaf(Element elem)
throws IOException
IOException - 如果发生任何 I/O 错误
protected void writeImage(Element elem)
throws IOException
elem - StyleConstants.IconElementName 类型元素
IOException
protected void writeComponent(Element elem)
throws IOException
IOExceptionprotected boolean isText(Element elem)
protected void writeContent(Element elem,
boolean needsIndenting)
throws IOException,
BadLocationException
IOException - 如果发生任何 I/O 错误
BadLocationException - 如果 pos 表示文档中的一个无效位置
protected void writeHTMLTags(AttributeSet attr)
throws IOException
IOException - 如果发生任何 I/O 错误
protected void writeNonHTMLAttributes(AttributeSet attr)
throws IOException
IOException - 如果发生任何 I/O 错误protected boolean inFontTag()
protected void endFontTag()
throws IOException
写出 <font> 标记的结束标记。
IOException - 如果发生任何 I/O 错误
protected void startFontTag(String style)
throws IOException
写出 <font> 标记的开始标记。因为字体标记不能嵌套,所以在此方法写出新的开始标记之前将关闭任何打开的字体标记。
IOException - 如果发生任何 I/O 错误
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。