de.vc.jfo.rtf

## Class FieldContext

- java.lang.Object
- - de.vc.jfo.rtf.DocumentContext
  - - de.vc.jfo.rtf.FieldContext

-     public class FieldContext
      extends DocumentContext

  Describes context information of a field. It also provides
  - Methodes for inserting result for a field
  - Access to instruction tokens (phrases)
  A field consist of an instruction and a (default) result. If an instruction is not evaluated then the default result is inserted. The instruction consist of some instruction tokens or phrases. E.g. there is a field with instruction {FILLIN "Who are you?"} then the tokens are FILLIN and "Who are you?", but not "FILLIN", "Who", "are", "you?".

- - ### Field Summary

    - ### Fields inherited from class de.vc.jfo.rtf.DocumentContext

      `AUTO_VALUE_DATA_ROW_INDEX`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `containsDateFormat()`
    `FormattingObject[]` | `getDefaultResult()` Gets the default result for the field that was stored in RTF.
    `FieldInfo` | `getFieldInfo()` Gets the field info of the context.
    `FormFieldDescriptor` | `getFormFieldDescriptor()` Gets a form specific description if this field is a form field or null otherwise.
    `java.lang.String` | `getInstructionText()` Gets the full instruction as String.
    `java.lang.String[]` | `getInstructionTextTokens()` Gets the instruction of the field as String tokens.
    `FieldInstructionToken[]` | `getInstructionTokens()` Gets the field instruction tokens.
    `org.apache.commons.logging.Log` | `getLogger()`
    `FieldInstructionToken` | `getNextInstructionToken(int startIndex, java.lang.String token)`
    `java.lang.String` | `getNextInstructionTokenText(int startIndex, java.lang.String token)` Gets the next instruction token of `token`.
    `java.lang.String` | `getNextInstructionTokenText(java.lang.String token)` Gets the next instruction token of `token`.
    `boolean` | `hasInstructionToken(java.lang.String t, boolean caseSensitive)` Checks if the field contains token `t`.
    `void` | `insert(Document doc)` Appends a full document at the current field position.
    `void` | `insert(java.lang.Object result, java.util.Map paragraphProperities)` This method is equivalent to `insert(Object obj)` but with a parameter for additional paragraph properties.
    `void` | `insertAutoValue(int autoValue)` Inserts an automatically generated value.
    `void` | `insertDocument(Document doc, boolean restartNumbering)` Appends a full document at the current field position.
    `void` | `insertDocumentContent(Document doc)` Inserts only the content of a document.
    `void` | `insertEmptyResult()` Inserts an empty (no) result for the field.
    `void` | `insertFormattedDate(java.util.Date date)`
    `void` | `insertListItems(java.lang.Object[] items)` Inserts values for a list.
    `void` | `insertResult(java.lang.Object result)` Deprecated. User insert(Object) instead.
    `void` | `insertResult(java.lang.Object result, boolean mergeFormat)` Deprecated. User insert(Object,boolean) instead.
    `void` | `insertTableColumn(java.lang.Object[] cells)` Inserts values for a table column.
    `boolean` | `isProcessed()` Checks if the field was processed by a field listener.
    `void` | `markProcessed()` Marks this field as processed.

    - ### Methods inherited from class de.vc.jfo.rtf.DocumentContext

      `addNamespace, doWrap, doWrap, findFile, getCurrentListItem, getCurrentTableRow, getDocument, getEstimator, getMappedFont, getRTF2FOConfig, insert, insert, insert, insertDocument, isInTable, isMergeFormat, setMergeFormat, transcodeString, wrapBlock, wrapListItem, wrapPageSequence, wrapParentNode, wrapTableRow`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getInstructionTextTokens

          public java.lang.String[] getInstructionTextTokens()

      Gets the instruction of the field as String tokens.
      Returns:
        Tokens of instruction as String.

    - #### getInstructionTokens

          public FieldInstructionToken[] getInstructionTokens()

      Gets the field instruction tokens.
      Returns:
        Tokens of instruction.

    - #### getInstructionText

          public java.lang.String getInstructionText()

      Gets the full instruction as String.
      Returns:
        Full instruction.

    - #### hasInstructionToken

          public boolean hasInstructionToken(java.lang.String t,
                                    boolean caseSensitive)

      Checks if the field contains token `t`.
      Parameters:
        `t` - Token.
        `caseSensitive` - Check case sensitive.
      Returns:
        `true` if field contains `t`.

    - #### getDefaultResult

          public FormattingObject[] getDefaultResult()

      Gets the default result for the field that was stored in RTF.
      Returns:
        Default result.

    - #### getNextInstructionTokenText

          public java.lang.String getNextInstructionTokenText(int startIndex,
                                                     java.lang.String token)

      Gets the next instruction token of `token`.
      Parameters:
        `startIndex` - Start index from that search of `token` is started.
        `token` - Token.
      Returns:
        Token that follows `token` or null if `token` not in instruction.

    - #### getNextInstructionTokenText

          public java.lang.String getNextInstructionTokenText(java.lang.String token)

      Gets the next instruction token of `token`.
      Parameters:
        `token` - Token.
      Returns:
        Token that follows `token` or null if `token` not in instruction.

    - #### getNextInstructionToken

          public FieldInstructionToken getNextInstructionToken(int startIndex,
                                                      java.lang.String token)

    - #### insert

          public void insert(java.lang.Object result,
                    java.util.Map paragraphProperities)

      Description copied from class: `DocumentContext`
      This method is equivalent to `insert(Object obj)` but with a parameter for additional paragraph properties.
      Overrides:
        `insert` in class `DocumentContext`
      Parameters:
        `result` - Object
        `paragraphProperities` - Additional properties that are applied to the current paragraph (fo:block).
      See Also:
        `DocumentContext.insert(Object,java.util.Map)`

    - #### insertResult

          public void insertResult(java.lang.Object result)

      Deprecated. User insert(Object) instead.
      Parameters:
        `result` - Object
      See Also:
        `DocumentContext.insert(Object)`

    - #### insertResult

          public void insertResult(java.lang.Object result,
                          boolean mergeFormat)

      Deprecated. User insert(Object,boolean) instead.
      Parameters:
        `result` - Object
        `mergeFormat` - Merge format.
      See Also:
        `DocumentContext.insert(Object,boolean)`

    - #### insert

          public void insert(Document doc)

      Appends a full document at the current field position. A new page sequence (section) is started and page numbering is not restarted.
      Parameters:
        `doc` - Document.

    - #### insertDocument

          public void insertDocument(Document doc,
                            boolean restartNumbering)

      Appends a full document at the current field position. A new page sequence (section) is started and optionally page numbering can be restarted.
      Overrides:
        `insertDocument` in class `DocumentContext`
      Parameters:
        `doc` - Document.
        `restartNumbering` - `true` to restart page numbering.

    - #### insertDocumentContent

          public void insertDocumentContent(Document doc)

      Inserts only the content of a document.
      Overrides:
        `insertDocumentContent` in class `DocumentContext`
      Parameters:
        `doc` - Document.

    - #### insertTableColumn

          public void insertTableColumn(java.lang.Object[] cells)

      Inserts values for a table column. Common object arrays are:
    - TableCell[]
    - String[]
    - Block[]
    - Inline[]

Overrides:
  `insertTableColumn` in class `DocumentContext`
Parameters:
  `cells` - Cells of column.

- #### insertAutoValue

      public void insertAutoValue(int autoValue)

  Description copied from class: `DocumentContext`
  Inserts an automatically generated value. Possible values are:
  - AUTO_VALUE_DATA_ROW_INDEX
  Overrides:
    `insertAutoValue` in class `DocumentContext`
  Parameters:
    `autoValue` - String
  See Also:
    `DocumentContext.AUTO_VALUE_DATA_ROW_INDEX`

- #### insertListItems

      public void insertListItems(java.lang.Object[] items)

  Inserts values for a list. Common object arrays are:
- String[] - With auto generated labels.
- ListItemBody[] - With auto generated labels.
- Block[] - With auto generated labels.
- ListItem[] - No auto generated labels.

Overrides:
  `insertListItems` in class `DocumentContext`
Parameters:
  `items` - Object[]

- #### insertEmptyResult

      public void insertEmptyResult()

  Inserts an empty (no) result for the field.

- #### isProcessed

      public boolean isProcessed()

  Checks if the field was processed by a field listener. A field is marked as processed if a result was inserted. A field listener should not insert a result for a field when it is marked as processed, it should just listen.
  Returns:
    `true` if handled.

- #### markProcessed

      public void markProcessed()

  Marks this field as processed. A field is automatically marked as processed when a result have been inserted by a field listener.

- #### getFormFieldDescriptor

      public FormFieldDescriptor getFormFieldDescriptor()

  Gets a form specific description if this field is a form field or null otherwise.
  Returns:
    FormFieldDescriptor

- #### containsDateFormat

      public boolean containsDateFormat()

- #### insertFormattedDate

      public void insertFormattedDate(java.util.Date date)

- #### getFieldInfo

      public FieldInfo getFieldInfo()

  Gets the field info of the context.
  Returns:
    FieldInfo

- #### getLogger

      public org.apache.commons.logging.Log getLogger()

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.