|
JavaTM 2 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 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。