com.inet.html
Class InetHtmlWriter

java.lang.Object
  extended by javax.swing.text.AbstractWriter
      extended by com.inet.html.InetHtmlWriter

public class InetHtmlWriter
extends javax.swing.text.AbstractWriter

Write the InetHtmlDocument as text/plain. Some protected method have the same signature like the Sun javax.swing.text.html.HTMLWriter to make it easer to port to this implementation.
As a 'special feature' this writer can replace image source links, which is useful for e-mails for instance.


Constructor Summary
InetHtmlWriter(java.io.Writer out, javax.swing.text.Document doc, int pos, int len)
          Create a new HTM4Writer
 
Method Summary
 int getEndOffset()
          
 void registerImageSRCreplace(java.util.Map<java.lang.String,java.lang.String> imageReplaceMap)
          Registers an image SRC replace map at this writer.
 void setInlineMode(boolean inlineMode)
          Sets the writer to inline-CSS mode.
static void setSorted(boolean sorted)
          Enable or disable the attribute sorting of the writer.
 void write()
          
 
Methods inherited from class javax.swing.text.AbstractWriter
getLineSeparator, getStartOffset, setLineSeparator
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InetHtmlWriter

public InetHtmlWriter(java.io.Writer out,
                      javax.swing.text.Document doc,
                      int pos,
                      int len)
Create a new HTM4Writer

Parameters:
out - any Writer
doc - a HTML4Document
pos - the start position of the document that should be written.
len - the length of data that should be written
Method Detail

write

public void write()
           throws javax.swing.text.BadLocationException,
                  java.io.IOException

Specified by:
write in class javax.swing.text.AbstractWriter
Throws:
javax.swing.text.BadLocationException
java.io.IOException

registerImageSRCreplace

public void registerImageSRCreplace(java.util.Map<java.lang.String,java.lang.String> imageReplaceMap)
Registers an image SRC replace map at this writer. If the SRC-location of an image element is registered in this map it will be replaced before it is written. Useful to redirect image locations for embedded images.

Parameters:
imageReplaceMap - Key=original location, Value=new location

getEndOffset

public int getEndOffset()

Overrides:
getEndOffset in class javax.swing.text.AbstractWriter

setSorted

public static void setSorted(boolean sorted)
Enable or disable the attribute sorting of the writer. Since writers are create internally on demand this option is static for all InetHtmlWriter on the current VM! Note: This will

Parameters:
sorted - true, if the attributes should be sorted

setInlineMode

public void setInlineMode(boolean inlineMode)
Sets the writer to inline-CSS mode. In this mode all linked stylesheets and the script tag will be dropped. Instead the effective styles will be written inline into each element. That way the writer generates an monolithic but style-reference free html output.

Parameters:
inlineMode - true to activate the inline mode, false to write a normal html content