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
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 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RtfDocumentThe RtfDocument this RtfField belongs toprivate static final byte[]Constant for a rtf fieldprivate static final byte[]Constant for an alt fieldprivate static final byte[]Constant for a dirty fieldprivate static final byte[]Constant for a edited fieldprivate static final byte[]Constant for the field instructionsprivate static final byte[]Constant for a locked fieldprivate static final byte[]Constant for a private fieldprivate static final byte[]Constant for the field resultprivate booleanIs it an alt fieldprivate booleanIs the field dirtyprivate booleanIs the field editedprivate booleanIs the field lockedprivate booleanIs the field privateprivate RtfFontThe RtfFont of this RtfFieldprivate booleanWhether this RtfElement is in a headerprivate booleanWhether this RtfField is in a tableFields 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, UNDERLINEFields 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, YMARKFields inherited from interface RtfBasicElement
CLOSE_GROUP, COMMA_DELIMITER, DELIMITER, OPEN_GROUP, TWIPS_FACTOR -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRtfField(RtfDocument doc) Constructs a RtfField for a RtfDocument.protectedRtfField(RtfDocument doc, com.lowagie.text.Font font) Constructs a RtfField for a RtfDocument. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisEmpty()An RtfField is never empty.booleanGet whether this field is an alt fieldbooleanGet whether this field is dirtybooleanGet whether this field is editedbooleanGet whether this field is lockedbooleanGet whether this field is privatebooleanGets whether thisRtfFieldis in a header.booleanGets whether thisRtfFieldis in a table.voidsetFieldAlt(boolean fieldAlt) Set whether this field is an alt fieldvoidsetFieldDirty(boolean fieldDirty) Set whether this field is dirtyvoidsetFieldEdit(boolean fieldEdit) Set whether this field is edited.voidsetFieldLocked(boolean fieldLocked) Set whether this field is lockedvoidsetFieldPrivate(boolean fieldPrivate) Set whether this field is privatevoidsetFont(com.lowagie.text.Font font) Override setFont to perform the correct font handling.voidsetInHeader(boolean inHeader) Sets whether this RtfField is in a headervoidsetInTable(boolean inTable) Sets whether this RtfField is in a tablevoidSets the RtfDocument this RtfElement belongs tovoidwriteContent(OutputStream result) Writes the field to theOutputStream.private voidwriteFieldBegin(OutputStream result) Writes the field beginning.private voidwriteFieldEnd(OutputStream result) Writes the end of the fieldprivate voidwriteFieldInstBegin(OutputStream result) Writes the beginning of the field instruction area.protected abstract voidwriteFieldInstContent(OutputStream result) Writes the content of the field instruction area.private voidwriteFieldInstEnd(OutputStream result) Writes the end of the field instruction area.private voidwriteFieldResultBegin(OutputStream result) Writes the beginning of the field result areaprotected abstract voidwriteFieldResultContent(OutputStream result) Writes the content of the pre-calculated field result.private voidwriteFieldResultEnd(OutputStream result) Writes the end of the field result areaMethods 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
-
Field Details
-
FIELD
private static final byte[] FIELDConstant for a rtf field -
FIELD_DIRTY
private static final byte[] FIELD_DIRTYConstant for a dirty field -
FIELD_PRIVATE
private static final byte[] FIELD_PRIVATEConstant for a private field -
FIELD_LOCKED
private static final byte[] FIELD_LOCKEDConstant for a locked field -
FIELD_EDIT
private static final byte[] FIELD_EDITConstant for a edited field -
FIELD_ALT
private static final byte[] FIELD_ALTConstant for an alt field -
FIELD_INSTRUCTIONS
private static final byte[] FIELD_INSTRUCTIONSConstant for the field instructions -
FIELD_RESULT
private static final byte[] FIELD_RESULTConstant for the field result -
fieldDirty
private boolean fieldDirtyIs the field dirty -
fieldEdit
private boolean fieldEditIs the field edited -
fieldLocked
private boolean fieldLockedIs the field locked -
fieldPrivate
private boolean fieldPrivateIs the field private -
fieldAlt
private boolean fieldAltIs it an alt field -
inTable
private boolean inTableWhether this RtfField is in a table -
inHeader
private boolean inHeaderWhether this RtfElement is in a header -
document
The RtfDocument this RtfField belongs to -
font
The RtfFont of this RtfField
-
-
Constructor Details
-
RtfField
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
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
Sets the RtfDocument this RtfElement belongs to- Specified by:
setRtfDocumentin interfaceRtfBasicElement- Parameters:
doc- The RtfDocument to use
-
writeFieldBegin
Writes the field beginning. Also writes field properties.- Parameters:
result- TheOutputStreamto write to.- Throws:
IOException
-
writeFieldInstBegin
Writes the beginning of the field instruction area.- Parameters:
result- TheOutputStreamto write to.- Throws:
IOException
-
writeFieldInstContent
Writes the content of the field instruction area. Override this method in your subclasses.- Parameters:
result- TheOutputStreamto write to.- Throws:
IOException
-
writeFieldInstEnd
Writes the end of the field instruction area.- Parameters:
result- TheOutputStreamto write to.- Throws:
IOException
-
writeFieldResultBegin
Writes the beginning of the field result area- Parameters:
result- TheOutputStreamto write to.- Throws:
IOException
-
writeFieldResultContent
Writes the content of the pre-calculated field result. Override this method in your subclasses.- Parameters:
result- TheOutputStreamto write to.- Throws:
IOException- on i/o errors.
-
writeFieldResultEnd
Writes the end of the field result area- Parameters:
result- TheOutputStreamto write to.- Throws:
IOException- on i/o errors.
-
writeFieldEnd
Writes the end of the field- Parameters:
result- TheOutputStreamto write to.- Throws:
IOException- on i/o errors.
-
writeContent
Writes the field to theOutputStream.- Specified by:
writeContentin interfaceRtfBasicElement- Parameters:
result- TheOutputStreamto 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:
setInTablein interfaceRtfBasicElement- Parameters:
inTable-Trueif this RtfField is in a table,falseotherwise
-
isInTable
public boolean isInTable()Gets whether thisRtfFieldis in a table.- Returns:
Trueif thisRtfFieldis in a table,falseotherwise- Since:
- 2.1.0
-
setInHeader
public void setInHeader(boolean inHeader) Sets whether this RtfField is in a header- Specified by:
setInHeaderin interfaceRtfBasicElement- Parameters:
inHeader-Trueif this RtfField is in a header,falseotherwise
-
isInHeader
public boolean isInHeader()Gets whether thisRtfFieldis in a header.- Returns:
Trueif thisRtfFieldis in a header,falseotherwise- Since:
- 2.1.0
-
isEmpty
public boolean isEmpty()An RtfField is never empty.- Overrides:
isEmptyin classcom.lowagie.text.Chunk
-
setFont
public void setFont(com.lowagie.text.Font font) Override setFont to perform the correct font handling.- Overrides:
setFontin classcom.lowagie.text.Chunk
-