Class FieldRef

java.lang.Object
org.docx4j.model.fields.FieldRef

public class FieldRef
extends java.lang.Object
The objective of this class is to represent a complex field (containing nested fields, if any; nested fields are represented by FieldRef object of their own). TODO, consider whether to make this abstract, with differing concrete implementations for top level and nested fields. Background. There are simple fields: 4/12/2011 and there are complex fields: REF hi \h Hello A simple field can also take the complex form: DATE 4/12/2011 A complex field can contain nested fields, in either its instruction part, or result part. we need to represent nest fields in the instructions part only (since nested fields in the results part get re-generated). An example of a nested field in the instructions part: IF 4/12/2011 ="4/12/2011" "it is 4/12" "not 4/12" today An example of nested fields in the results part: TOC \o "1-3" \h \z \ u one PAGEREF _Toc310757867 \h 1 oneone PAGEREF _Toc310757868 \h 1 In general, you can "canonicalise" the field representation to be (i) instructions, contained within a single run (ii) results, immediately following, though not nec just as following siblings (iii) the final Since the purpose of our field support is to update the field results, we can delete (ii) and (iii) before adding them in again. The document is preprocessed to put it into this form.
Author:
jharrop
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.lang.String fldName  
  • Constructor Summary

    Constructors 
    Constructor Description
    FieldRef​(FldChar fldCharBegin)  
  • Method Summary

    Modifier and Type Method Description
    R getBeginRun()  
    Text getCustomFieldData()
    application-specific data associated with this field.
    R getEndRun()  
    java.lang.String getFldName()
    The name of the (outer most) field, for example DATE, MERGEFIELD.
    CTFFData getFormFieldProperties()
    Properties specific to FORMCHECKBOX, FORMDROPDOWN, FORMTEXT
    java.util.List<java.lang.Object> getInstructions()  
    ContentAccessor getParent()  
    R getResultsSlot()  
    boolean haveSeenSeparate()  
    boolean isDirty()
    Specifies that this field has been flagged by an application to indicate that its current results are invalid (stale) due to other modifications made to the document, and these contents should be updated before they are displayed.
    boolean isLock()  
    java.lang.Boolean isMergeFormat()  
    void setBeginRun​(R beginRun)  
    void setCustomFieldData​(Text customFieldData)  
    void setDirty​(boolean dirty)  
    void setEndRun​(R endRun)  
    void setFormFieldProperties​(CTFFData formFieldProperties)  
    void setLock​(boolean lock)
    Specifies that the parent complex field shall not have its field result recalculated, even if an application attempts to recalculate the results of all fields in the document or a recalculation is explicitly requested.
    void setParent​(ContentAccessor parent)  
    void setResult​(java.lang.String val)  
    void setResultsSlot​(R resultsSlot)  
    void setSeenSeparate​(boolean seenSeparate)  

    Methods inherited from class java.lang.Object

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

    • fldName

      protected java.lang.String fldName
  • Constructor Details

  • Method Details

    • getFldName

      public java.lang.String getFldName()
      The name of the (outer most) field, for example DATE, MERGEFIELD. Assume for now that this is contained in instructions.get(0).
      Returns:
      See Also:
      field syntax
    • getParent

      public ContentAccessor getParent()
    • setParent

      public void setParent​(ContentAccessor parent)
    • getBeginRun

      public R getBeginRun()
    • setBeginRun

      public void setBeginRun​(R beginRun)
    • haveSeenSeparate

      public boolean haveSeenSeparate()
    • setSeenSeparate

      public void setSeenSeparate​(boolean seenSeparate)
    • isMergeFormat

      public java.lang.Boolean isMergeFormat()
      Returns:
      whether \* MERGEFORMAT is set
    • isDirty

      public boolean isDirty()
      Specifies that this field has been flagged by an application to indicate that its current results are invalid (stale) due to other modifications made to the document, and these contents should be updated before they are displayed.
      Returns:
      whether stale
      See Also:
      the spec
    • setDirty

      public void setDirty​(boolean dirty)
      Parameters:
      whether - stale
      See Also:
      the spec
    • isLock

      public boolean isLock()
      Returns:
      the lock
      See Also:
      the spec
    • setLock

      public void setLock​(boolean lock)
      Specifies that the parent complex field shall not have its field result recalculated, even if an application attempts to recalculate the results of all fields in the document or a recalculation is explicitly requested.
      Parameters:
      lock - the lock to set
      See Also:
      the spec
    • getCustomFieldData

      public Text getCustomFieldData()
      application-specific data associated with this field.
      Returns:
      the customFieldData
      See Also:
      the spec
    • setCustomFieldData

      public void setCustomFieldData​(Text customFieldData)
      Parameters:
      customFieldData - the customFieldData to set
      See Also:
      the spec
    • getFormFieldProperties

      public CTFFData getFormFieldProperties()
      Properties specific to FORMCHECKBOX, FORMDROPDOWN, FORMTEXT
      Returns:
      the formFieldProperties
      See Also:
      the spec
    • setFormFieldProperties

      public void setFormFieldProperties​(CTFFData formFieldProperties)
      Parameters:
      formFieldProperties - the formFieldProperties to set
      See Also:
      the spec
    • getEndRun

      public R getEndRun()
    • setEndRun

      public void setEndRun​(R endRun)
    • getInstructions

      public java.util.List<java.lang.Object> getInstructions()
      Returns:
      the instructions
    • getResultsSlot

      public R getResultsSlot()
    • setResultsSlot

      public void setResultsSlot​(R resultsSlot)
    • setResult

      public void setResult​(java.lang.String val)