所有类


javax.swing.text.html
类 HTMLWriter

java.lang.Object
  继承者 javax.swing.text.AbstractWriter
      继承者 javax.swing.text.html.HTMLWriter

public class HTMLWriter
   
   
   
   
extends AbstractWriter

这是用于 HTMLDocuments 的 writer。


字段摘要
 
从类 javax.swing.text.AbstractWriter 继承的字段
NEWLINE
 
构造方法摘要
HTMLWriter(Writer w, HTMLDocument doc)
          创建新的 HTMLWriter。
HTMLWriter(Writer w, HTMLDocument doc, int pos, int len)
          创建新的 HTMLWriter。
 
方法摘要
protected  voidcloseOutUnwantedEmbeddedTags(AttributeSet attr)
          搜索属性集和存储在标记向量中的每个标记。
protected  voidcomment(Element elem)
          写出注释。
protected  voidemptyTag(Element elem)
          写出所有空元素(没有对应结束标记的所有标记)。
protected  voidendTag(Element elem)
          写出元素的结束标记。
protected  booleanisBlockTag(AttributeSet attr)
          确定与该元素关联的 HTML.Tag 是否为块标记。
protected  booleanmatchNameAttribute(AttributeSet attr, HTML.Tag tag)
          如果 StyleConstants.NameAttribute 与作为参数传入的标记相同,则返回 true。
protected  voidoutput(char[] chars, int start, int length)
          重写此方法来映射任何字符实体,例如 < 映射到 <。
protected  voidselectContent(AttributeSet attr)
          写出 SELECT 表单元素的内容。
protected  voidstartTag(Element elem)
          写出元素的开始标记。
protected  booleansynthesizedElement(Element elem)
          如果元素是合成元素,则返回 true。
protected  voidtext(Element elem)
          写出文本。
protected  voidtextAreaContent(AttributeSet attr)
          写出 TEXTAREA 表单元素中所包含的文本。
 voidwrite()
          对 Element 树进行迭代并控制所有标记及其属性的写出。
protected  voidwriteAttributes(AttributeSet attr)
          写出属性集。
protected  voidwriteEmbeddedTags(AttributeSet attr)
          搜索 AttributeSet 中的嵌入式标记并写出它们。
protected  voidwriteLineSeparator()
          写出行分隔符。
protected  voidwriteOption(Option option)
          写出 Option 表单元素的内容。
 
从类 javax.swing.text.AbstractWriter 继承的方法
decrIndent, getCanWrapLines, getCurrentLineLength, getDocument, getElementIterator, getEndOffset, getIndentLevel, getIndentSpace, getLineLength, getLineSeparator, getStartOffset, getText, getWriter, incrIndent, indent, inRange, isLineEmpty, setCanWrapLines, setCurrentLineLength, setIndentSpace, setLineLength, setLineSeparator, write, write, write
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

HTMLWriter

public HTMLWriter(Writer w,
                  HTMLDocument doc)
创建新的 HTMLWriter。

参数:
w - Writer
doc - HTMLDocument

HTMLWriter

public HTMLWriter(Writer w,
                  HTMLDocument doc,
                  int pos,
                  int len)
创建新的 HTMLWriter。

参数:
w - Writer
doc - HTMLDocument
pos - 文档位置,从此位置获取内容
len - 写出量
方法详细信息

write

public void write()
           throws IOException,
                  BadLocationException
对 Element 树进行迭代并控制所有标记及其属性的写出。

指定者:
AbstractWriter 中的 write
抛出:
IOException - 如果发生任何 I/O 错误
BadLocationException - 如果 pos 表示文档中的无效位置。

writeAttributes

protected void writeAttributes(AttributeSet attr)
                        throws IOException
写出属性集。忽略带有类型 HTML.Tag 键的所有属性,带有类型 StyleConstants 键的所有属性,以及带有类型 HTML.Attribute.ENDTAG 键的所有属性。

覆盖:
AbstractWriter 中的 writeAttributes
参数:
attr - AttributeSet
抛出:
IOException - 如果发生任何 I/O 错误

emptyTag

protected void emptyTag(Element elem)
                 throws BadLocationException,
                        IOException
写出所有空元素(没有对应结束标记的所有标记)。

参数:
elem - Element
抛出:
IOException - 如果发生任何 I/O 错误
BadLocationException - 如果 pos 表示文档中的无效位置。

isBlockTag

protected boolean isBlockTag(AttributeSet attr)
确定与该元素关联的 HTML.Tag 是否为块标记。

参数:
attr - AttributeSet
返回:
如果标记是块标记,则返回 true;否则返回 false。

startTag

protected void startTag(Element elem)
                 throws IOException,
                        BadLocationException
写出元素的开始标记。忽略所有的合成元素。

参数:
elem - Element
抛出:
IOException - 如果发生任何 I/O 错误
BadLocationException

textAreaContent

protected void textAreaContent(AttributeSet attr)
                        throws BadLocationException,
                               IOException
写出 TEXTAREA 表单元素中所包含的文本。

参数:
attr - AttributeSet
抛出:
IOException - 如果发生任何 I/O 错误
BadLocationException - 如果 pos 表示文档中的无效位置。