Package org.docx4j.model.fields
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.StringfldName -
Constructor Summary
-
Method Summary
Modifier and Type Method Description RgetBeginRun()TextgetCustomFieldData()application-specific data associated with this field.RgetEndRun()java.lang.StringgetFldName()The name of the (outer most) field, for example DATE, MERGEFIELD.CTFFDatagetFormFieldProperties()Properties specific to FORMCHECKBOX, FORMDROPDOWN, FORMTEXTjava.util.List<java.lang.Object>getInstructions()ContentAccessorgetParent()RgetResultsSlot()booleanhaveSeenSeparate()booleanisDirty()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.booleanisLock()java.lang.BooleanisMergeFormat()voidsetBeginRun(R beginRun)voidsetCustomFieldData(Text customFieldData)voidsetDirty(boolean dirty)voidsetEndRun(R endRun)voidsetFormFieldProperties(CTFFData formFieldProperties)voidsetLock(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.voidsetParent(ContentAccessor parent)voidsetResult(java.lang.String val)voidsetResultsSlot(R resultsSlot)voidsetSeenSeparate(boolean seenSeparate)
-
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
-
setParent
-
getBeginRun
-
setBeginRun
-
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
application-specific data associated with this field.- Returns:
- the customFieldData
- See Also:
- the spec
-
setCustomFieldData
- Parameters:
customFieldData- the customFieldData to set- See Also:
- the spec
-
getFormFieldProperties
Properties specific to FORMCHECKBOX, FORMDROPDOWN, FORMTEXT- Returns:
- the formFieldProperties
- See Also:
- the spec
-
setFormFieldProperties
- Parameters:
formFieldProperties- the formFieldProperties to set- See Also:
- the spec
-
getEndRun
-
setEndRun
-
getInstructions
public java.util.List<java.lang.Object> getInstructions()- Returns:
- the instructions
-
getResultsSlot
-
setResultsSlot
-
setResult
public void setResult(java.lang.String val)
-