- java.lang.Object
- 
- javax.swing.text.AbstractWriter
- 
- javax.swing.text.html.MinimalHTMLWriter
 
 
- 
 public class MinimalHTMLWriter extends AbstractWriter MinimalHTMLWriterは、エディタ・キットで作成されないドキュメントのHTMLを書き出すためにHTMLEditorKitが使用する代替ライターです。 ドキュメントの形式は次のとおりです。<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 voidendFontTag()現在使われていません。代わりに<span>が書き出されます。protected booleaninFontTag()<font>タグ内ならtrueを返します。protected booleanisText(Element elem)要素がテキストならtrueを返します。protected voidstartFontTag(String style)現在使われていません。代わりに<span>が書き出されます。protected voidtext(Element elem)テキストを書き出します。voidwrite()StyledDocumentからHTML出力を生成します。protected voidwriteAttributes(AttributeSet attr)StyleConstants.ParagraphConstants、StyleConstants.CharacterConstants、StyleConstants.FontConstants、StyleConstants.ColorConstantsの各型のすべての属性を書き出します。protected voidwriteBody()ドキュメント内の要素で反復し、枝の要素か葉の要素かを判断して要素を処理します。protected voidwriteComponent(Element elem)コンポーネント要素の書出しを行います。意図的に実装しない場合があります。protected voidwriteContent(Element elem, boolean needsIndenting)HTMLに準拠した方法で属性セットを書き出します。protected voidwriteEndParagraph()<p>タグの終了タグを発行します。protected voidwriteEndTag(String endTag)適切にインデント処理された終了タグを書き出します。protected voidwriteHeader()<head>および<style>のタグを書出し、次にwriteStyles()を起動して<style>タグのコンテンツとしてすべての名前付き書式を書き出します。protected voidwriteHTMLTags(AttributeSet attr)属性設定に基づいてテキストのボールド<b>、イタリック<i>、および<u>のタグを生成します。protected voidwriteImage(Element elem)アイコン要素の書出しを行います。意図的に実装しない場合があります。protected voidwriteLeaf(Element elem)テキスト以外の葉の要素の書出しを制御します。protected voidwriteNonHTMLAttributes(AttributeSet attr)HTMLに準拠した方法で残りの文字レベルの属性(ボールド、イタリック、下線以外の属性)を書き出します。protected voidwriteStartParagraph(Element elem)段落の開始タグを発行します。protected voidwriteStartTag(String tag)適切にインデント処理された開始タグを書き出します。protected voidwriteStyles()<style>タグのコンテンツとしてすべての名前付き書式を書き出します。- 
クラス javax.swing.text.AbstractWriterで宣言されたメソッドdecrIndent, getCanWrapLines, getCurrentLineLength, getDocument, getElementIterator, getEndOffset, getIndentLevel, getIndentSpace, getLineLength, getLineSeparator, getStartOffset, getText, getWriter, incrIndent, indent, inRange, isLineEmpty, output, setCanWrapLines, setCurrentLineLength, setIndentSpace, setLineLength, setLineSeparator, write, write, write, writeLineSeparator
 
- 
 
- 
- 
- 
コンストラクタの詳細- 
MinimalHTMLWriterpublic MinimalHTMLWriter(Writer w, StyledDocument doc) 新しいMinimalHTMLWriterを作成します。- パラメータ:
- w- ライター
- doc- StyledDocument
 
 - 
MinimalHTMLWriterpublic MinimalHTMLWriter(Writer w, StyledDocument doc, int pos, int len) 新しいMinimalHTMLWriterを作成します。- パラメータ:
- w- ライター
- doc- StyledDocument
- pos- コンテンツを取得するドキュメント内の位置。
- len- 書き出す量。
 
 
- 
 - 
メソッドの詳細- 
writepublic void write() throws IOException, BadLocationExceptionStyledDocumentからHTML出力を生成します。- 定義:
- write、クラス:- AbstractWriter
- 例外:
- IOException- 入出力エラーが発生した場合
- BadLocationException- posがドキュメント内の無効な位置を表す場合。
 
 - 
writeAttributesprotected void writeAttributes(AttributeSet attr) throws IOException StyleConstants.ParagraphConstants、StyleConstants.CharacterConstants、StyleConstants.FontConstants、StyleConstants.ColorConstantsの各型のすべての属性を書き出します。 属性名と値はコロンで区切られます。 各ペアはセミコロンで区切られます。- オーバーライド:
- writeAttributes、クラス:- AbstractWriter
- パラメータ:
- attr- AttributeSet。
- 例外:
- IOException- 入出力エラーが発生した場合
 
 - 
textprotected void text(Element elem) throws IOException, BadLocationException テキストを書き出します。- オーバーライド:
- text、クラス:- AbstractWriter
- パラメータ:
- elem- Element。
- 例外:
- IOException- 入出力エラーが発生した場合
- BadLocationException- posがドキュメント内の無効な位置を表す場合。
 
 - 
writeStartTagprotected void writeStartTag(String tag) throws IOException 適切にインデント処理された開始タグを書き出します。 またインデント・レベルを増分します。- パラメータ:
- tag- 開始タグ
- 例外:
- IOException- 入出力エラーが発生した場合
 
 - 
writeEndTagprotected void writeEndTag(String endTag) throws IOException 適切にインデント処理された終了タグを書き出します。 またインデント・レベルを減らします。- パラメータ:
- endTag- 終了タグ
- 例外:
- IOException- 入出力エラーが発生した場合
 
 - 
writeHeaderprotected void writeHeader() throws IOException<head>および<style>のタグを書出し、次にwriteStyles()を起動して<style>タグのコンテンツとしてすべての名前付き書式を書き出します。 コンテンツの前後には、タグをサポートしないアプリケーションやブラウザでもドキュメントが表示できるように、有効なHTMLコメント・マーカーが配置されます。- 例外:
- IOException- 入出力エラーが発生した場合
 
 - 
writeStylesprotected void writeStyles() throws IOException<style>タグのコンテンツとしてすべての名前付き書式を書き出します。- 例外:
- IOException- 入出力エラーが発生した場合
 
 - 
writeBodyprotected void writeBody() throws IOException, BadLocationExceptionドキュメント内の要素で反復し、枝の要素か葉の要素かを判断して要素を処理します。 テキストである葉の要素には特別な処理を行います。- 例外:
- IOException- 入出力エラーが発生した場合
- BadLocationException- 私たちが文書内の無効なロケーションにいる場合。
 
 - 
writeEndParagraphprotected void writeEndParagraph() throws IOException<p>タグの終了タグを発行します。 タグを書き出す前に、オープンしているほかのすべてのタグが正しくクローズされることを確認します。- 例外:
- IOException- 入出力エラーが発生した場合
 
 - 
writeStartParagraphprotected void writeStartParagraph(Element elem) throws IOException 段落の開始タグを発行します。 段落に対応する名前付きスタイルがあれば、<p>タグのクラス属性も生成してその値をスタイルの名前に設定します。- パラメータ:
- elem- 要素
- 例外:
- IOException- 入出力エラーが発生した場合
 
 - 
writeLeafprotected void writeLeaf(Element elem) throws IOException テキスト以外の葉の要素の書出しを制御します。- パラメータ:
- elem- 要素
- 例外:
- IOException- 入出力エラーが発生した場合
 
 - 
writeImageprotected void writeImage(Element elem) throws IOException アイコン要素の書出しを行います。意図的に実装しない場合があります。 このメソッドの実装方法はポリシーの問題です。 たとえば、<img>タグを生成することになっている場合、src属性(イメージの位置)を表すには、 場合によって、URLを使用することもストリームから読み込むこともあります。- パラメータ:
- elem- StyleConstants.IconElementName型の要素
- 例外:
- IOException- I/Oエラーが発生した場合。
 
 - 
writeComponentprotected void writeComponent(Element elem) throws IOException コンポーネント要素の書出しを行います。意図的に実装しない場合があります。 このメソッドの実装方法はポリシーの問題です。- パラメータ:
- elem- StyleConstants.ComponentElementName型の要素
- 例外:
- IOException- I/Oエラーが発生した場合。
 
 - 
isTextprotected boolean isText(Element elem) 要素がテキストならtrueを返します。- パラメータ:
- elem- 要素
- 戻り値:
- 要素がテキスト要素の場合はtrue。
 
 - 
writeContentprotected void writeContent(Element elem, boolean needsIndenting) throws IOException, BadLocationException HTMLに準拠した方法で属性セットを書き出します。- パラメータ:
- elem- 要素
- needsIndenting-- needsIndentingが- trueならばインデントが追加されます
- 例外:
- IOException- 入出力エラーが発生した場合
- BadLocationException- posがドキュメント内の無効な位置を表す場合。
 
 - 
writeHTMLTagsprotected void writeHTMLTags(AttributeSet attr) throws IOException 属性設定に基づいてテキストのボールド<b>、イタリック<i>、および<u>のタグを生成します。- パラメータ:
- attr- 属性のセット
- 例外:
- IOException- 入出力エラーが発生した場合
 
 - 
writeNonHTMLAttributesprotected void writeNonHTMLAttributes(AttributeSet attr) throws IOException HTMLに準拠した方法で残りの文字レベルの属性(ボールド、イタリック、下線以外の属性)を書き出します。 フォント・ファミリやフォント・サイズなどの属性が直接HTMLタグにマッピングされない場合、インライン・スタイルの場合と同様に<span>タグが生成されて、そのスタイル属性が残りの属性のリストを含むように設定されます。- パラメータ:
- attr- 属性のセット
- 例外:
- IOException- 入出力エラーが発生した場合
 
 - 
inFontTagprotected boolean inFontTag() <font>タグ内ならtrueを返します。- 戻り値:
- 現在<font>タグがある場合はtrueです。
 
 - 
endFontTagprotected void endFontTag() throws IOException現在使われていません。代わりに<span>が書き出されます。<font>タグ用の終了タグを書き出します。 - 例外:
- IOException- 入出力エラーが発生した場合
 
 - 
startFontTagprotected void startFontTag(String style) throws IOException 現在使われていません。代わりに<span>が書き出されます。<font>タグ用の開始タグを書き出します。 フォント・タグは入れ子にできないため、新しい開始タグを書き出す前に、フォント・タグの囲みをクローズします。 - パラメータ:
- style- フォント・スタイル
- 例外:
- IOException- 入出力エラーが発生した場合
 
 
- 
 
-