JavaTM 2 Platform
Standard Ed. 5.0

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>
        <! -- list of named styles
         p.normal {
            font-family: SansSerif;
              margin-height: 0;
              font-size: 14
           }
        -->
      </style>
   </head>
   <body>
    <p style=normal>
        ½ÇÇà ÆÄÀÏÀÇ º¼µå, ÀÌÅŸ¯ ¹× ¹ØÁÙ
       
 °¢ ¼Ó¼ºÀº HTML ű׷μ­ ¹ßÇàµË´Ï´Ù.
        ±× ¿ÜÀÇ Å±״ <span> ű×ÀÇ        ÀϺημ­ ¹ßÇàµË´Ï´Ù.
        ±¸¹®Àº ÀÎ ¶óÀÎÀÇ ½ºÅ¸ÀÏ°ú °°½À´Ï´Ù. 
    </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 ()
          ÇöÀç »ç¿ëµÇÁö ¾Ê½À´Ï´Ù.
protected  boolean inFontTag ()
          <font> ű׳»¶ó¸é true¸¦ ¸®ÅÏÇÕ´Ï´Ù.
protected  boolean isText (Element  elem)
          ¿ä¼Ò°¡ ÅؽºÆ®¶ó¸é true¸¦ ¸®ÅÏÇÕ´Ï´Ù.
protected  void startFontTag (String  style)
          ÇöÀç »ç¿ëµÇÁö ¾Ê½À´Ï´Ù.
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)
          HTML¿¡ ÁØ°ÅÇÑ ¹æ¹ýÀ¸·Î ¼Ó¼º ¼¼Æ®¸¦ ½á³À´Ï´Ù.
protected  void writeEndParagraph ()
          <p> ű׿¡ ´ëÇÑ Á¾·á ű׸¦ ¹ßÇàÇÕ´Ï´Ù.
protected  void writeEndTag (String  endTag)
          ÀûÀýÈ÷ Àε§Æ® ó¸®µÈ Á¾·á ű׸¦ ½á³À´Ï´Ù.
protected  void writeHeader ()
          <head> ¹× <style> ű׸¦ ½á³», ´ÙÀ½¿¡ writeStyles()¸¦ ½ÃÀÛÇØ <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, 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
 
Ŭ·¡½º 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 - ¶óÀÌÅÍ
doc - StyledDocument
pos - ÄÁÅÙÃ÷¸¦ ¾ò´Â ¹®¼­³»ÀÇ À§Ä¡
len - ½á³»´Â ¾ç
¸Þ¼­µåÀÇ »ó¼¼

write

public void write()
           throws IOException,

                  BadLocationException 
StyledDocument ·ÎºÎÅÍ HTML Ãâ·ÂÀ» »ý¼ºÇÕ´Ï´Ù.

Á¤ÀÇ:
Ŭ·¡½º AbstractWriter ³»ÀÇ write
¿¹¿Ü:
IOException - ÀÔÃâ·Â ¿¡·¯°¡ ¹ß»ýÇßÀ» °æ¿ì
BadLocationException - pos°¡ ¹®¼­³»ÀÇ ¹«È¿ÀÎ À§Ä¡¸¦ ³ªÅ¸³»´Â °æ¿ì

writeAttributes

protected void writeAttributes(AttributeSet  attr)
                        throws IOException 
´ÙÀ½ÀÇ Çü¿ëÀÇ ¸ðµç ¼Ó¼ºÀ» ½á³À´Ï´Ù. StyleConstants.ParagraphConstants, StyleConstants.CharacterConstants, StyleConstants.FontConstants, StyleConstants.ColorConstants. ¼Ó¼º¸í°ú °ªÀº ±¸µÎÁ¡À¸·Î °¢ Á¶´Â ¼¼¹ÌÄÝ·ÐÀ¸·Î °¢°¢ ´Ü¶ôÁö¾îÁý´Ï´Ù.

¿À¹ö¶óÀ̵å(override):
Ŭ·¡½º AbstractWriter ³»ÀÇ writeAttributes
ÆĶó¹ÌÅÍ:
attr - AttributeSet
¿¹¿Ü:
IOException - ÀÔÃâ·Â ¿¡·¯°¡ ¹ß»ýÇßÀ» °æ¿ì

text

protected void text(Element  elem)
             throws IOException,

                    BadLocationException 
ÅؽºÆ®¸¦ ½á³À´Ï´Ù.

¿À¹ö¶óÀ̵å(override):
Ŭ·¡½º AbstractWriter ³»ÀÇ text
ÆĶó¹ÌÅÍ:
elem - Element
¿¹¿Ü:
IOException - ÀÔÃâ·Â ¿¡·¯°¡ ¹ß»ýÇßÀ» °æ¿ì
BadLocationException - pos°¡ ¹®¼­³»ÀÇ ¹«È¿ÀÎ À§Ä¡¸¦ ³ªÅ¸³»´Â °æ¿ì

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 - ÀÔÃâ·Â ¿¡·¯°¡ ¹ß»ýÇßÀ» °æ¿ì
BadLocationException

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 ÇüÀÇ ¿ä¼Ò
¿¹¿Ü:
IOException

writeComponent

protected void writeComponent(Element  elem)
                       throws IOException 
ÄÄÆÛ³ÍÆ® ¿ä¼ÒÀÇ ¼­µÎ¸¦ ½Ç½ÃÇÕ´Ï´Ù. µµÀûÀ¸·Î ±¸ÇöÇÏÁö ¾Ê´Â °æ¿ì°¡ ÀÖ½À´Ï´Ù. ÀÌ ¸Þ¼­µåÀÇ ±¸Çö ¹æ¹ýÀº Á¤Ã¥ ÀÇ ¹®Á¦ÀÔ´Ï´Ù.

¿¹¿Ü:
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 ÁØ°ÅÀÇ ¹æ¹ýÀ¸·Î ³ª¸ÓÁöÀÇ ¹®ÀÚ ·¹º§ÀÇ ¼Ó¼º (º¼µå, ÀÌÅŸ¯, ¹ØÁÙ ÀÌ¿ÜÀÇ ¼Ó¼º)À» ½á³À´Ï´Ù. ÆùÆ® Æйи®³ª font sizeµîÀÇ ¼Ó¼ºÀÌ Á÷Á¢ HTML ű׿¡ ¸ÅÇÎ µÇÁö ¾Ê´Â °æ¿ì, ÀÎ ¶óÀÎ ½ºÅ¸ÀÏÀÇ °æ¿ì¿Í °°°Ô <span> űװ¡ »ý¼ºµÇ¾î, ±× ½ºÅ¸ÀÏ ¼Ó¼ºÀÌ ³ª¸ÓÁöÀÇ ¼Ó¼ºÀÇ ¸®½ºÆ®¸¦ Æ÷ÇÔÇϵµ·Ï ¼³Á¤µË´Ï´Ù.

¿¹¿Ü:
IOException - ÀÔÃâ·Â ¿¡·¯°¡ ¹ß»ýÇßÀ» °æ¿ì

inFontTag

protected boolean inFontTag()
<font> ű׳»¶ó¸é true¸¦ ¸®ÅÏÇÕ´Ï´Ù.


endFontTag

protected void endFontTag()
                   throws IOException 
ÇöÀç »ç¿ëµÇÁö ¾Ê½À´Ï´Ù. ´ë½Å¿¡ <span>°¡ ½á³»Áý´Ï´Ù.

<font> ű׿ëÀÇ Á¾·á ű׸¦ ½á³À´Ï´Ù.

¿¹¿Ü:
IOException - ÀÔÃâ·Â ¿¡·¯°¡ ¹ß»ýÇßÀ» °æ¿ì

startFontTag

protected void startFontTag(String  style)
                     throws IOException 
ÇöÀç »ç¿ëµÇÁö ¾Ê½À´Ï´Ù. ´ë½Å¿¡ <span>°¡ ½á³»Áý´Ï´Ù.

<font> ű׿ëÀÇ °³½Ã ű׸¦ ½á³À´Ï´Ù. ÆùÆ® ű״ »óÀÚ·Î ÇÒ ¼ö ¾ø±â ¶§¹®¿¡ »õ·Î¿î °³½Ã ű׸¦ ½á³»±â Àü¿¡ ÆùÆ® ű×ÀÇ Æ÷À§¸¦ ´Ý½À´Ï´Ù.

¿¹¿Ü:
IOException - ÀÔÃâ·Â ¿¡·¯°¡ ¹ß»ýÇßÀ» °æ¿ì

JavaTM 2 Platform
Standard Ed. 5.0

Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy µµ ÂüÁ¶ÇϽʽÿÀ.