Java プラットフォーム 1.2

javax.swing.text.html
クラス MinimalHTMLWriter

java.lang.Object
  |
  +--javax.swing.text.AbstractWriter
        |
        +--javax.swing.text.html.MinimalHTMLWriter

public class MinimalHTMLWriter
extends AbstractWriter

MinimalHTMLWriter は、エディタキットで作成されないドキュメントの HTML を書き出すために HTMLEditorKit が使用する代替ライターです。 ドキュメントの形式は次のとおりです。

 <html>
   <head>
     <style>
        <!-- 名前付きスタイルのリスト
         p.normal {
            font-family: SansSerif;
            margin-height: 0;
            font-size: 14
       }
        -->
      </style>
   </head>
   <body>
    <p style=normal>
     <b> 行の並びのボールド、イタリック、および下線の属性は
     HTML タグとして発行される。それ以外の属性は <font> タグ
     の部分的なスタイル属性として発行される。構文はインラインスタ
     イルに類似する</b>
    </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()
          <font> タグ用の終了タグを書き出します。
protected  boolean inFontTag()
          <font> タグ内なら true を返します。
protected  boolean isText(Element elem)
          要素がテキストなら true を返します。
protected  void startFontTag(String style)
          <font> タグ用の開始タグを書き出します。
protected  void text(Element elem)
          テキストの書き出しを制御します。
 void write()
          StyledDocument からの HTML 出力の生成を制御します。
protected  void writeAttributes(AttributeSet attr)
          次の型用のすべての属性を書き出します。
protected  void writeBody()
          キュメント内の要素で反復され、枝の要素か葉の要素かを判断して要素を処理します。
protected  void writeComponent(Element elem)
          コンポーネント要素の書き出しを制御します。
protected  void writeContent(Element elem, boolean needsIndenting)
          テキストの書き出しを処理します。
protected  void writeEndParagraph()
          <p> タグに対する終了タグの発行を処理します。
protected  void writeEndTag(String endTag)
          適切にインデント処理された終了タグを書き出します。
protected  void writeHeader()
          <head> および <style> のタグを書き出します。
protected  void writeHTMLTags(AttributeSet attr)
          属性設定に基づいてテキストのボールド <b>、イタリック <i>、および <u> のタグ生成を制御します。
protected  void writeImage(Element elem)
          アイコン要素の書き出しを制御します。
protected  void writeLeaf(Element elem)
          テキスト以外の葉の要素の書き出しを制御します。
protected  void writeNonHTMLAttributes(AttributeSet attr)
          HTML 準拠の方法でキャラクタレベル属性 (ボールド、イタリック、アンダーライン以外の属性) の書き出しを制御します。
protected  void writeStartParagraph(Element elem)
          段落の開始タグを発行します。
protected  void writeStartTag(String tag)
          適切にインデント処理された開始タグを書き出します。
protected  void writeStyles()
          <style> タグのコンテンツとしてすべての名前付きスタイルを書き出します。
 
クラス javax.swing.text.AbstractWriter から継承したメソッド
decrIndent, getDocument, getElementIterator, getText, incrIndent, indent, inRange, setIndentSpace, setLineLength, write, write
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

MinimalHTMLWriter

public MinimalHTMLWriter(Writer w,
                         StyledDocument doc)
新しい MinimalHTMLWriter を作成します。
パラメータ:
w - ライター
doc - StyledDocument

MinimalHTMLWriter

public MinimalHTMLWriter(Writer w,
                         StyledDocument doc,
                         int pos,
                         int len)
新しい MinimalHTMLWriter を作成します。
パラメータ:
w - Writer
doc - StyledDocument
pos - ドキュメント内でコンテンツを取得する位置
len - 書き出す量
メソッドの詳細

write

public void write()
           throws IOException,
                  BadLocationException
StyledDocument からの HTML 出力の生成を制御します。
例外:
IOException - 入出力エラーが発生した場合
BadLocationException - pos がドキュメント内の無効な位置を示す場合
オーバーライド:
クラス AbstractWriter 内の write

writeAttributes

protected void writeAttributes(AttributeSet attr)
                        throws IOException
次の型用のすべての属性を書き出します。
  StyleConstants.ParagraphConstants
  StyleConstants.CharacterConstants
  StyleConstants.FontConstants
  StyleConstants.ColorConstants.
属性名と値はコロンで、各組はセミコロンでそれぞれ区切られます。
例外:
IOException - 入出力エラーが発生した場合
オーバーライド:
クラス AbstractWriter 内の writeAttributes

text

protected void text(Element elem)
             throws IOException,
                    BadLocationException
テキストの書き出しを制御します。
例外:
IOException - 入出力エラーが発生した場合
オーバーライド:
クラス AbstractWriter 内の text

writeStartTag

protected void writeStartTag(String tag)
                      throws IOException
適切にインデント処理された開始タグを書き出します。またインデントレベルをインクリメントします。
例外:
IOException - 入出力エラーが発生した場合

writeEndTag

protected void writeEndTag(String endTag)
                    throws IOException
適切にインデント処理された終了タグを書き出します。またインデントレベルをデクリメントします。
例外:
IOException - 入出力エラーが発生した場合

writeHeader

protected void writeHeader()
                    throws IOException
<head> および <style> のタグを書き出します。次に writeStyles() を起動して <style> タグのコンテンツとしてすべての名前付きのスタイルを書き出します。コンテンツの前後には、タグをサポートしないアプリケーション/ブラウザでもドキュメントが表示できるように、有効な HTML コメントメーカが配置されます。
例外:
IOException - 入出力エラーが発生した場合

writeStyles

protected void writeStyles()
                    throws IOException
<style> タグのコンテンツとしてすべての名前付きスタイルを書き出します。
例外:
IOException - 入出力エラーが発生した場合

writeBody

protected void writeBody()
                  throws IOException,
                         BadLocationException
キュメント内の要素で反復され、枝の要素か葉の要素かを判断して要素を処理します。テキストである (ドキュメントの) 葉の要素には特別な処理を行います。
例外:
IOException - 入出力エラーが発生した場合

writeEndParagraph

protected void writeEndParagraph()
                          throws IOException
<p> タグに対する終了タグの発行を処理します。タグを書き出す前に、オープン済みのそれ以外のすべてのタグが正しくクローズされることを確認します。
例外:
IOException - 入出力エラーが発生した場合

writeStartParagraph

protected void writeStartParagraph(Element elem)
                            throws IOException
段落の開始タグを発行します。段落に対応する名前付きスタイルがあれば、<p> タグのクラス属性を生成してその値をスタイルの名前に設定します。
例外:
IOException - 入出力エラーが発生した場合

writeLeaf

protected void writeLeaf(Element elem)
                  throws IOException
テキスト以外の葉の要素の書き出しを制御します。
例外:
IOException - 入出力エラーが発生した場合

writeImage

protected void writeImage(Element elem)
                   throws IOException
アイコン要素の書き出しを制御します。このメソッドは実装されない場合があります。実装方法はポリシー以上に重要です。たとえば、<img> タグを生成することになっている場合、src 属性 (ビューの位置) をどのように表すかという問題が起こります。場合によって、url であることも、またストリームから読み込まれることもあります。
パラメータ:
elem - StyleConstants.IconElementName 型の要素

writeComponent

protected void writeComponent(Element elem)
                       throws IOException
コンポーネント要素の書き出しを制御します。このメソッドの実装はポリシーに従います。したがって、実装されないままになっています。

isText

protected boolean isText(Element elem)
要素がテキストなら true を返します。

writeContent

protected void writeContent(Element elem,
                            boolean needsIndenting)
                     throws IOException,
                            BadLocationException
テキストの書き出しを処理します。HTML 準拠の方法による属性セットの 書き出しを制御するメソッドを起動します。
例外:
IOException - 入出力エラーが発生した場合
BadLocationException - pos がドキュメント内の無効な位置を示す場合

writeHTMLTags

protected void writeHTMLTags(AttributeSet attr)
                      throws IOException
属性設定に基づいてテキストのボールド <b>、イタリック <i>、および <u> のタグ生成を制御します。
例外:
IOException - 入出力エラーが発生した場合

writeNonHTMLAttributes

protected void writeNonHTMLAttributes(AttributeSet attr)
                               throws IOException
HTML 準拠の方法でキャラクタレベル属性 (ボールド、イタリック、アンダーライン以外の属性) の書き出しを制御します。フォントファミリなどの属性では、フォントサイズ等は直接 HTML タグにはマッピングされず、インラインスタイルの場合と同様に <font> タグが生成されてそれ以外の属性のリストを収めるスタイル属性が生成されます。
例外:
IOException - 入出力エラーが発生した場合

inFontTag

protected boolean inFontTag()
<font> タグ内なら true を返します。

endFontTag

protected void endFontTag()
                   throws IOException
<font> タグ用の終了タグを書き出します。
例外:
IOException - 入出力エラーが発生した場合

startFontTag

protected void startFontTag(String style)
                     throws IOException
<font> タグ用の開始タグを書き出します。そのフォントタグを入れ子にできない場合は、フォントタグ内なら新しい開始タグを書き出す前に囲むタグをクローズします。
例外:
IOException - 入出力エラーが発生した場合

Java プラットフォーム 1.2

バグや機能要求の報告
新しい javadoc の表示についてのコメントやご提案
Java は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.