Class RtfField

java.lang.Object
com.lowagie.text.Chunk
com.lowagie.text.rtf.field.RtfField
All Implemented Interfaces:
com.lowagie.text.Element, RtfBasicElement
Direct Known Subclasses:
RtfAnchor, RtfPageNumber, RtfTableOfContents, RtfTOCEntry, RtfTotalPageNumber

public abstract class RtfField extends com.lowagie.text.Chunk implements RtfBasicElement
The RtfField class is an abstract base class for all rtf field functionality. Subclasses only need to implement the two abstract methods writeFieldInstContent and writeFieldResultContent. All other field functionality is handled by the RtfField class.
Version:
$Id: RtfField.java 3580 2008-08-06 15:52:00Z howard_s $
Author:
Mark Hall (Mark.Hall@mail.room3b.eu), Dirk Weigenand (Dirk.Weigenand@smb-tec.com), Thomas Bickel (tmb99@inode.at)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected RtfDocument
    The RtfDocument this RtfField belongs to

    Fields inherited from class com.lowagie.text.Chunk

    ACTION, attributes, BACKGROUND, CHAR_SPACING, COLOR, content, ENCODING, GENERICTAG, HSCALE, HYPHENATION, IMAGE, LOCALDESTINATION, LOCALGOTO, NEWLINE, NEWPAGE, NEXTPAGE, OBJECT_REPLACEMENT_CHARACTER, PDFANNOTATION, REMOTEGOTO, SEPARATOR, SKEW, SPLITCHARACTER, SUBSUPSCRIPT, TAB, TEXTRENDERMODE, UNDERLINE

    Fields inherited from interface com.lowagie.text.Element

    ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, FOOTNOTE, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MODIFICATIONDATE, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructs a RtfField for a RtfDocument.
    protected
    RtfField(RtfDocument doc, com.lowagie.text.Font font)
    Constructs a RtfField for a RtfDocument.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    An RtfField is never empty.
    boolean
    Get whether this field is an alt field
    boolean
    Get whether this field is dirty
    boolean
    Get whether this field is edited
    boolean
    Get whether this field is locked
    boolean
    Get whether this field is private
    boolean
    Gets whether this RtfField is in a header.
    boolean
    Gets whether this RtfField is in a table.
    void
    setFieldAlt(boolean fieldAlt)
    Set whether this field is an alt field
    void
    setFieldDirty(boolean fieldDirty)
    Set whether this field is dirty
    void
    setFieldEdit(boolean fieldEdit)
    Set whether this field is edited.
    void
    setFieldLocked(boolean fieldLocked)
    Set whether this field is locked
    void
    setFieldPrivate(boolean fieldPrivate)
    Set whether this field is private
    void
    setFont(com.lowagie.text.Font font)
    Override setFont to perform the correct font handling.
    void
    setInHeader(boolean inHeader)
    Sets whether this RtfField is in a header
    void
    setInTable(boolean inTable)
    Sets whether this RtfField is in a table
    void
    Sets the RtfDocument this RtfElement belongs to
    void
    Writes the field to the OutputStream.
    protected abstract void
    Writes the content of the field instruction area.
    protected abstract void
    Writes the content of the pre-calculated field result.

    Methods inherited from class com.lowagie.text.Chunk

    append, getCharacterSpacing, getChunkAttributes, getChunks, getContent, getFont, getHorizontalScaling, getHyphenation, getImage, getTextRise, getWidthPoint, hasAttributes, isContent, isNestable, process, setAction, setAnchor, setAnchor, setAnnotation, setBackground, setBackground, setCharacterSpacing, setChunkAttributes, setGenericTag, setHorizontalScaling, setHyphenation, setLocalDestination, setLocalGoto, setNewPage, setRemoteGoto, setRemoteGoto, setSkew, setSplitCharacter, setTextRenderMode, setTextRise, setUnderline, setUnderline, toString, type

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • document

      protected RtfDocument document
      The RtfDocument this RtfField belongs to
  • Constructor Details

    • RtfField

      protected RtfField(RtfDocument doc)
      Constructs a RtfField for a RtfDocument. This is not very useful, since the RtfField by itself does not do anything. Use one of the subclasses instead.
      Parameters:
      doc - The RtfDocument this RtfField belongs to.
    • RtfField

      protected RtfField(RtfDocument doc, com.lowagie.text.Font font)
      Constructs a RtfField for a RtfDocument. This is not very useful, since the RtfField by itself does not do anything. Use one of the subclasses instead.
      Parameters:
      doc - The RtfDocument this RtfField belongs to.
      font - The Font this RtfField should use
  • Method Details

    • setRtfDocument

      public void setRtfDocument(RtfDocument doc)
      Sets the RtfDocument this RtfElement belongs to
      Specified by:
      setRtfDocument in interface RtfBasicElement
      Parameters:
      doc - The RtfDocument to use
    • writeFieldInstContent

      protected abstract void writeFieldInstContent(OutputStream result) throws IOException
      Writes the content of the field instruction area. Override this method in your subclasses.
      Parameters:
      result - The OutputStream to write to.
      Throws:
      IOException
    • writeFieldResultContent

      protected abstract void writeFieldResultContent(OutputStream result) throws IOException
      Writes the content of the pre-calculated field result. Override this method in your subclasses.
      Parameters:
      result - The OutputStream to write to.
      Throws:
      IOException - on i/o errors.
    • writeContent

      public void writeContent(OutputStream result) throws IOException
      Writes the field to the OutputStream.
      Specified by:
      writeContent in interface RtfBasicElement
      Parameters:
      result - The OutputStream to write to.
      Throws:
      IOException - on i/o errors.
    • isFieldAlt

      public boolean isFieldAlt()
      Get whether this field is an alt field
      Returns:
      Returns whether this field is an alt field
    • setFieldAlt

      public void setFieldAlt(boolean fieldAlt)
      Set whether this field is an alt field
      Parameters:
      fieldAlt - The value to use
    • isFieldDirty

      public boolean isFieldDirty()
      Get whether this field is dirty
      Returns:
      Returns whether this field is dirty
    • setFieldDirty

      public void setFieldDirty(boolean fieldDirty)
      Set whether this field is dirty
      Parameters:
      fieldDirty - The value to use
    • isFieldEdit

      public boolean isFieldEdit()
      Get whether this field is edited
      Returns:
      Returns whether this field is edited
    • setFieldEdit

      public void setFieldEdit(boolean fieldEdit)
      Set whether this field is edited.
      Parameters:
      fieldEdit - The value to use
    • isFieldLocked

      public boolean isFieldLocked()
      Get whether this field is locked
      Returns:
      Returns the fieldLocked.
    • setFieldLocked

      public void setFieldLocked(boolean fieldLocked)
      Set whether this field is locked
      Parameters:
      fieldLocked - The value to use
    • isFieldPrivate

      public boolean isFieldPrivate()
      Get whether this field is private
      Returns:
      Returns the fieldPrivate.
    • setFieldPrivate

      public void setFieldPrivate(boolean fieldPrivate)
      Set whether this field is private
      Parameters:
      fieldPrivate - The value to use
    • setInTable

      public void setInTable(boolean inTable)
      Sets whether this RtfField is in a table
      Specified by:
      setInTable in interface RtfBasicElement
      Parameters:
      inTable - True if this RtfField is in a table, false otherwise
    • isInTable

      public boolean isInTable()
      Gets whether this RtfField is in a table.
      Returns:
      True if this RtfField is in a table, false otherwise
      Since:
      2.1.0
    • setInHeader

      public void setInHeader(boolean inHeader)
      Sets whether this RtfField is in a header
      Specified by:
      setInHeader in interface RtfBasicElement
      Parameters:
      inHeader - True if this RtfField is in a header, false otherwise
    • isInHeader

      public boolean isInHeader()
      Gets whether this RtfField is in a header.
      Returns:
      True if this RtfField is in a header, false otherwise
      Since:
      2.1.0
    • isEmpty

      public boolean isEmpty()
      An RtfField is never empty.
      Overrides:
      isEmpty in class com.lowagie.text.Chunk
    • setFont

      public void setFont(com.lowagie.text.Font font)
      Override setFont to perform the correct font handling.
      Overrides:
      setFont in class com.lowagie.text.Chunk