com.lowagie.text.rtf.field

Class RtfField

public abstract class RtfField extends 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 2776 2007-05-23 20:01:40Z hallm $

Author: Mark Hall (mhall@edu.uni-klu.ac.at) Dirk Weigenand (Dirk.Weigenand@smb-tec.com) Thomas Bickel (tmb99@inode.at)

Field Summary
protected RtfDocumentdocument
The RtfDocument this RtfField belongs to
booleanfieldAlt
Is it an alt field
booleanfieldDirty
Is the field dirty
booleanfieldEdit
Is the field edited
booleanfieldLocked
Is the field locked
booleanfieldPrivate
Is the field private
RtfFontfont
The RtfFont of this RtfField
static byte[]FIELD
Constant for a rtf field
static byte[]FIELD_ALT
Constant for an alt field
static byte[]FIELD_DIRTY
Constant for a dirty field
static byte[]FIELD_EDIT
Constant for a edited field
static byte[]FIELD_INSTRUCTIONS
Constant for the field instructions
static byte[]FIELD_LOCKED
Constant for a locked field
static byte[]FIELD_PRIVATE
Constant for a private field
static byte[]FIELD_RESULT
Constant for the field result
booleaninHeader
Whether this RtfElement is in a header
booleaninTable
Whether this RtfField is in a table
Constructor Summary
protected RtfField(RtfDocument doc)
Constructs a RtfField for a RtfDocument.
protected RtfField(RtfDocument doc, Font font)
Constructs a RtfField for a RtfDocument.
Method Summary
booleanisEmpty()
An RtfField is never empty.
booleanisFieldAlt()
Get whether this field is an alt field
booleanisFieldDirty()
Get whether this field is dirty
booleanisFieldEdit()
Get whether this field is edited
booleanisFieldLocked()
Get whether this field is locked
booleanisFieldPrivate()
Get whether this field is private
voidsetFieldAlt(boolean fieldAlt)
Set whether this field is an alt field
voidsetFieldDirty(boolean fieldDirty)
Set whether this field is dirty
voidsetFieldEdit(boolean fieldEdit)
Set whether this field is edited.
voidsetFieldLocked(boolean fieldLocked)
Set whether this field is locked
voidsetFieldPrivate(boolean fieldPrivate)
Set whether this field is private
voidsetFont(Font font)
Override setFont to perform the correct font handling.
voidsetInHeader(boolean inHeader)
Sets whether this RtfField is in a header
voidsetInTable(boolean inTable)
Sets whether this RtfField is in a table
voidsetRtfDocument(RtfDocument doc)
Sets the RtfDocument this RtfElement belongs to
byte[]write()
Write the content of this RtfField.
voidwriteContent(OutputStream result)
Writes the element content to the given output stream.
byte[]writeFieldBegin()
Writes the field beginning.
voidwriteFieldBegin(OutputStream result)
Writes the field beginning.
byte[]writeFieldEnd()
Writes the end of the field
voidwriteFieldEnd(OutputStream result)
Writes the end of the field
byte[]writeFieldInstBegin()
Writes the beginning of the field instruction area.
voidwriteFieldInstBegin(OutputStream result)
Writes the beginning of the field instruction area.
protected abstract byte[]writeFieldInstContent()
Writes the content of the field instruction area.
protected voidwriteFieldInstContent(OutputStream out)
Writes the content of the field instruction area.
byte[]writeFieldInstEnd()
Writes the end of the field instruction area.
voidwriteFieldInstEnd(OutputStream result)
Writes the end of the field instruction area.
byte[]writeFieldResultBegin()
Writes the beginning of the field result area
voidwriteFieldResultBegin(OutputStream result)
Writes the beginning of the field result area
protected abstract byte[]writeFieldResultContent()
Writes the content of the pre-calculated field result.
protected voidwriteFieldResultContent(OutputStream out)
Writes the content of the pre-calculated field result.
byte[]writeFieldResultEnd()
Writes the end of the field result area
voidwriteFieldResultEnd(OutputStream result)
Writes the end of the field result area

Field Detail

document

protected RtfDocument document
The RtfDocument this RtfField belongs to

fieldAlt

private boolean fieldAlt
Is it an alt field

fieldDirty

private boolean fieldDirty
Is the field dirty

fieldEdit

private boolean fieldEdit
Is the field edited

fieldLocked

private boolean fieldLocked
Is the field locked

fieldPrivate

private boolean fieldPrivate
Is the field private

font

private RtfFont font
The RtfFont of this RtfField

FIELD

private static final byte[] FIELD
Constant for a rtf field

FIELD_ALT

private static final byte[] FIELD_ALT
Constant for an alt field

FIELD_DIRTY

private static final byte[] FIELD_DIRTY
Constant for a dirty field

FIELD_EDIT

private static final byte[] FIELD_EDIT
Constant for a edited field

FIELD_INSTRUCTIONS

private static final byte[] FIELD_INSTRUCTIONS
Constant for the field instructions

FIELD_LOCKED

private static final byte[] FIELD_LOCKED
Constant for a locked field

FIELD_PRIVATE

private static final byte[] FIELD_PRIVATE
Constant for a private field

FIELD_RESULT

private static final byte[] FIELD_RESULT
Constant for the field result

inHeader

private boolean inHeader
Whether this RtfElement is in a header

inTable

private boolean inTable
Whether this RtfField is in a table

Constructor Detail

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, 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 Detail

isEmpty

public boolean isEmpty()
An RtfField is never empty.

isFieldAlt

public boolean isFieldAlt()
Get whether this field is an alt field

Returns: Returns whether this field is an alt field

isFieldDirty

public boolean isFieldDirty()
Get whether this field is dirty

Returns: Returns whether this field is dirty

isFieldEdit

public boolean isFieldEdit()
Get whether this field is edited

Returns: Returns whether this field is edited

isFieldLocked

public boolean isFieldLocked()
Get whether this field is locked

Returns: Returns the fieldLocked.

isFieldPrivate

public boolean isFieldPrivate()
Get whether this field is private

Returns: Returns the fieldPrivate.

setFieldAlt

public void setFieldAlt(boolean fieldAlt)
Set whether this field is an alt field

Parameters: fieldAlt The value to use

setFieldDirty

public void setFieldDirty(boolean fieldDirty)
Set whether this field is dirty

Parameters: fieldDirty The value to use

setFieldEdit

public void setFieldEdit(boolean fieldEdit)
Set whether this field is edited.

Parameters: fieldEdit The value to use

setFieldLocked

public void setFieldLocked(boolean fieldLocked)
Set whether this field is locked

Parameters: fieldLocked The value to use

setFieldPrivate

public void setFieldPrivate(boolean fieldPrivate)
Set whether this field is private

Parameters: fieldPrivate The value to use

setFont

public void setFont(Font font)
Override setFont to perform the correct font handling.

setInHeader

public void setInHeader(boolean inHeader)
Sets whether this RtfField is in a header

Parameters: inHeader True if this RtfField is in a header, false otherwise

setInTable

public void setInTable(boolean inTable)
Sets whether this RtfField is in a table

Parameters: inTable True if this RtfField is in a table, false otherwise

setRtfDocument

public void setRtfDocument(RtfDocument doc)
Sets the RtfDocument this RtfElement belongs to

Parameters: doc The RtfDocument to use

write

public byte[] write()

Deprecated: replaced by writeContent

Write the content of this RtfField.

Returns: A byte array containing the content of this RtfField

writeContent

public void writeContent(OutputStream result)
Writes the element content to the given output stream.

writeFieldBegin

private byte[] writeFieldBegin()

Deprecated: replaced by writeFieldBegin

Writes the field beginning. Also writes field properties.

Returns: A byte array with the field beginning.

Throws: IOException

writeFieldBegin

private void writeFieldBegin(OutputStream result)
Writes the field beginning. Also writes field properties.

Returns: A byte array with the field beginning.

Throws: IOException

writeFieldEnd

private byte[] writeFieldEnd()

Deprecated: replaced by writeFieldEnd

Writes the end of the field

Returns: A byte array containing the end of the field

Throws: IOException

writeFieldEnd

private void writeFieldEnd(OutputStream result)
Writes the end of the field

writeFieldInstBegin

private byte[] writeFieldInstBegin()

Deprecated: replaced by writeFieldInstBegin

Writes the beginning of the field instruction area.

Returns: The beginning of the field instruction area

Throws: IOException

writeFieldInstBegin

private void writeFieldInstBegin(OutputStream result)
Writes the beginning of the field instruction area.

Returns: The beginning of the field instruction area

Throws: IOException

writeFieldInstContent

protected abstract byte[] writeFieldInstContent()

Deprecated: replaced by writeFieldInstContent

Writes the content of the field instruction area. Override this method in your subclasses.

Returns: The content of the field instruction area

Throws: IOException If an error occurs.

writeFieldInstContent

protected void writeFieldInstContent(OutputStream out)
Writes the content of the field instruction area. Override this method in your subclasses.

writeFieldInstEnd

private byte[] writeFieldInstEnd()

Deprecated: replaced by writeFieldInstEnd

Writes the end of the field instruction area.

Returns: A byte array containing the end of the field instruction area

Throws: IOException

writeFieldInstEnd

private void writeFieldInstEnd(OutputStream result)
Writes the end of the field instruction area.

writeFieldResultBegin

private byte[] writeFieldResultBegin()

Deprecated: replaced by writeFieldResultBegin

Writes the beginning of the field result area

Returns: A byte array containing the beginning of the field result area

Throws: IOException

writeFieldResultBegin

private void writeFieldResultBegin(OutputStream result)
Writes the beginning of the field result area

writeFieldResultContent

protected abstract byte[] writeFieldResultContent()

Deprecated: replaced by writeFieldResultContent

Writes the content of the pre-calculated field result. Override this method in your subclasses.

Returns: A byte array containing the field result

Throws: IOException If an error occurs

writeFieldResultContent

protected void writeFieldResultContent(OutputStream out)
Writes the content of the pre-calculated field result. Override this method in your subclasses.

writeFieldResultEnd

private byte[] writeFieldResultEnd()

Deprecated: replaced by writeFieldResultEnd

Writes the end of the field result area

Returns: A byte array containing the end of the field result area

Throws: IOException

writeFieldResultEnd

private void writeFieldResultEnd(OutputStream result)
Writes the end of the field result area