Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jfor.jfor.rtflib.rtfdoc
Class RtfElement  view RtfElement download RtfElement.java

java.lang.Object
  extended byorg.jfor.jfor.rtflib.rtfdoc.RtfElement
Direct Known Subclasses:
RtfBookmark, RtfContainer, RtfExternalGraphic, RtfFontTable, RtfLineBreak, RtfPageBreak, RtfText

public abstract class RtfElement
extends java.lang.Object

Base class for all elements of an RTF file.


Field Summary
protected  RtfAttributes m_attrib
           
private  boolean m_closed
           
private  int m_id
           
private static int m_idCounter
           
protected  RtfContainer m_parent
           
protected  java.io.Writer m_writer
           
private  boolean m_written
           
 
Constructor Summary
(package private) RtfElement(RtfContainer parent, java.io.Writer w)
          Create an RTF element as a child of given container
(package private) RtfElement(RtfContainer parent, java.io.Writer w, RtfAttributes attr)
          Create an RTF element as a child of given container with given attributes
 
Method Summary
 void close()
          Does nothing, meant to allow elements to write themselves without waiting for write(), but not implemented yet
(package private)  void dump(java.io.Writer w, int indent)
          debugging to given PrintWriter
(package private)  RtfElement getParentOfClass(java.lang.Class c)
          find the first parent where c.isAssignableFrom(parent.getClass()) is true
 RtfAttributes getRtfAttributes()
           
(package private)  RtfFile getRtfFile()
          access our RtfFile, which is always the topmost parent
(package private)  boolean isClosed()
          true if close() has been called
abstract  boolean isEmpty()
          true if this element would generate no "useful" RTF content
protected  boolean okToWriteRtf()
          can be overridden to suppress all RTF output
 java.lang.String toString()
          minimal debugging display
protected  void writeAttributes(RtfAttributes attr, java.lang.String[] nameList)
          write given attribute values to our Writer
protected  void writeControlWord(java.lang.String word)
          write an RTF control word to our Writer
protected  void writeControlWordNS(java.lang.String word)
          write rtf control word without the space behind it
protected  void writeExceptionInRtf(java.lang.Exception ie)
           
protected  void writeGroupMark(boolean isStart)
          Write a start or end group mark
protected  void writeOneAttribute(java.lang.String name, java.lang.Object value)
          write one attribute to our Writer
protected  void writeOneAttributeNS(java.lang.String name, java.lang.Object value)
          write one attribute to our Writer without a space
 void writeRtf()
          write the RTF code of this element to our Writer
protected abstract  void writeRtfContent()
          must be implemented to write RTF content to m_writer
protected  void writeRtfPrefix()
          called before writeRtfContent()
protected  void writeRtfSuffix()
          called after writeRtfContent()
protected  void writeStarControlWord(java.lang.String word)
          write an RTF control word to our Writer, preceeded by a star '*' meaning "ignore this if you don't know what it means"
protected  void writeStarControlWordNS(java.lang.String word)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_writer

protected final java.io.Writer m_writer

m_parent

protected final RtfContainer m_parent

m_attrib

protected final RtfAttributes m_attrib

m_written

private boolean m_written

m_closed

private boolean m_closed

m_id

private final int m_id

m_idCounter

private static int m_idCounter
Constructor Detail

RtfElement

RtfElement(RtfContainer parent,
           java.io.Writer w)
     throws java.io.IOException
Create an RTF element as a child of given container


RtfElement

RtfElement(RtfContainer parent,
           java.io.Writer w,
           RtfAttributes attr)
     throws java.io.IOException
Create an RTF element as a child of given container with given attributes

Method Detail

close

public final void close()
                 throws java.io.IOException
Does nothing, meant to allow elements to write themselves without waiting for write(), but not implemented yet


writeRtf

public final void writeRtf()
                    throws java.io.IOException
write the RTF code of this element to our Writer


writeControlWord

protected final void writeControlWord(java.lang.String word)
                               throws java.io.IOException
write an RTF control word to our Writer


writeStarControlWord

protected final void writeStarControlWord(java.lang.String word)
                                   throws java.io.IOException
write an RTF control word to our Writer, preceeded by a star '*' meaning "ignore this if you don't know what it means"


writeStarControlWordNS

protected final void writeStarControlWordNS(java.lang.String word)
                                     throws java.io.IOException

writeControlWordNS

protected final void writeControlWordNS(java.lang.String word)
                                 throws java.io.IOException
write rtf control word without the space behind it


writeRtfPrefix

protected void writeRtfPrefix()
                       throws java.io.IOException
called before writeRtfContent()


writeRtfContent

protected abstract void writeRtfContent()
                                 throws java.io.IOException
must be implemented to write RTF content to m_writer


writeRtfSuffix

protected void writeRtfSuffix()
                       throws java.io.IOException
called after writeRtfContent()


writeGroupMark

protected final void writeGroupMark(boolean isStart)
                             throws java.io.IOException
Write a start or end group mark


writeAttributes

protected void writeAttributes(RtfAttributes attr,
                               java.lang.String[] nameList)
                        throws java.io.IOException
write given attribute values to our Writer


writeOneAttribute

protected void writeOneAttribute(java.lang.String name,
                                 java.lang.Object value)
                          throws java.io.IOException
write one attribute to our Writer


writeOneAttributeNS

protected void writeOneAttributeNS(java.lang.String name,
                                   java.lang.Object value)
                            throws java.io.IOException
write one attribute to our Writer without a space


okToWriteRtf

protected boolean okToWriteRtf()
can be overridden to suppress all RTF output


dump

void dump(java.io.Writer w,
          int indent)
    throws java.io.IOException
debugging to given PrintWriter


toString

public java.lang.String toString()
minimal debugging display


isClosed

boolean isClosed()
true if close() has been called


getRtfFile

RtfFile getRtfFile()
access our RtfFile, which is always the topmost parent


getParentOfClass

RtfElement getParentOfClass(java.lang.Class c)
find the first parent where c.isAssignableFrom(parent.getClass()) is true


isEmpty

public abstract boolean isEmpty()
true if this element would generate no "useful" RTF content


writeExceptionInRtf

protected void writeExceptionInRtf(java.lang.Exception ie)
                            throws java.io.IOException

getRtfAttributes

public RtfAttributes getRtfAttributes()