Class TextField
- java.lang.Object
-
- com.adobe.xfa.text.TextLegacy
-
- com.adobe.xfa.text.TextStream
-
- com.adobe.xfa.text.TextField
-
public class TextField extends TextStream
A text field extends the text stream class (TextStream) with the ability to behave as a field. As a text stream, a text field represents a container of rich text, embedded fields and other objects.While a text field may stand alone as a container of data in an application, it does not support layout and display on its own. Instead, a field must be embedded in another text stream, possibly another field.
Layout and rendering are operations on a displayable text stream (see class TextDispStr). For a field to participate in layout, its root ancestor in the text stream hierarchy must be a displayable stream.
The application may choose to use instances of this class directly, or it may further derive its own class. By inserting instances of its own class into the parent stream, the application can cache its own information with each field.
-
-
Field Summary
Fields Modifier and Type Field Description static int
EMBED_FORMATTED
static int
EMBED_RAW
static int
EMBEDTYPE_SOM
static int
EMBEDTYPE_URI
-
Fields inherited from class com.adobe.xfa.text.TextStream
DEFAULT_STREAM
-
Fields inherited from class com.adobe.xfa.text.TextLegacy
LEVEL_CORRECT_SPACING, LEVEL_NORMAL, LEVEL_V6
-
-
Constructor Summary
Constructors Constructor Description TextField()
Default constructor.TextField(int eEmbedMode, int eEmbedType, java.lang.String sExpression)
TextField(TextField oSource)
Copy constructor.TextField(java.lang.String sFieldText)
Constructor with source text string.TextField(java.lang.String sFieldText, int eEmbedMode, int eEmbedType)
TextField(java.lang.String sFieldText, int eEmbedMode, int eEmbedType, java.lang.String sExpression)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TextField
cloneField()
Overridable method to create a new instance.void
copyFrom(TextField oSource)
Assign this field's content from the given field.boolean
equals(java.lang.Object object)
Compare text fields for content equality.int
getEmbedMode()
int
getEmbedType()
java.lang.String
getExpression()
int
hashCode()
boolean
isEqual(TextField oCompare)
Overridable equality comparison.boolean
notEqual(TextField oCompare)
Compare text fields for content inequality.TextPosn
position()
Return the position of this field in the parent stream.void
setEmbedMode(int eEmbedMode)
void
setEmbedType(int eEmbedType)
void
setExpression(java.lang.String sExpression)
-
Methods inherited from class com.adobe.xfa.text.TextStream
allowNewLines, allowNewLines, anyNewLines, append, append, append, append, append, append, cascadeLegacyLevel, coalesceMarker, contiguousText, copyFrom, currentSize, debug, display, enumEmbed, enumField, enumMarker, find, find, findRangeMarkerOver, fontService, fontService, getContext, gfxSource, gfxSource, isDescendentOf, isDescendentOf, legacyPositioning, markup, markup, markup, markup, markup, maxSize, maxSize, notEqual, posnCount, posnInsert, posnInsert, posnInsertPara, posnNext, posnNextAttr, posnNextChar, posnNextEmbed, posnNextField, posnNextType, posnNextType, posnPrev, posnPrevAttr, posnPrevChar, posnPrevEmbed, posnPrevField, posnPrevType, posnPrevType, posnUpdateStreamLoc, rangeEnumMarker, rangeMarker, rangeMarkerInternal, removeMarker, setText, spaceLeft, splitMarker, suppressFormat, text, text, updateNotification
-
Methods inherited from class com.adobe.xfa.text.TextLegacy
getLegacyLevel, hasCorrectPositioning, hasLegacyPositioning, hasNormalPositioning, setLegacyLevel
-
-
-
-
Field Detail
-
EMBEDTYPE_SOM
public static final int EMBEDTYPE_SOM
- See Also:
- Constant Field Values
-
EMBEDTYPE_URI
public static final int EMBEDTYPE_URI
- See Also:
- Constant Field Values
-
EMBED_RAW
public static final int EMBED_RAW
- See Also:
- Constant Field Values
-
EMBED_FORMATTED
public static final int EMBED_FORMATTED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TextField
public TextField()
Default constructor.The text field contains no content, has no pool/mapping assocotiation and is not embedded in any other stream.
-
TextField
public TextField(TextField oSource)
Copy constructor.Copy all content from the source field. Also copies the graphic source of the given stream. The field is initially not embedded in any stream.
- Parameters:
oSource
- Source text field to copy content from.
-
TextField
public TextField(java.lang.String sFieldText, int eEmbedMode, int eEmbedType)
-
TextField
public TextField(java.lang.String sFieldText, int eEmbedMode, int eEmbedType, java.lang.String sExpression)
-
TextField
public TextField(int eEmbedMode, int eEmbedType, java.lang.String sExpression)
-
TextField
public TextField(java.lang.String sFieldText)
Constructor with source text string.Create a text field whose initial content is copied from the given string. The text stream initially has no attribute pool or font mapper association, and is not embedded in any stream.
- Parameters:
sFieldText
- String whose contents are to be copied to the field.
-
-
Method Detail
-
copyFrom
public void copyFrom(TextField oSource)
Assign this field's content from the given field.Replace this stream's content with a copy of the content of the given stream. The graphic source information is not copied. In other words, fonts will be re-mapped in this stream's font mapper and attributes will be re-pooled in any attribute pool associated with this stream.
- Parameters:
oSource
- Field containing source content to copy.
-
equals
public boolean equals(java.lang.Object object)
Compare text fields for content equality.Compare this field against the one passed on the parameter object for content equality. The graphics sources of the fields are not compared. To be equal, the fields' content must match in all aspects: raw text, attributes, embedded field content, and so on.
- Overrides:
equals
in classTextStream
- Parameters:
object
- Field to compare against- Returns:
- TRUE if the fields are equal; FALSE otherwise.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classTextStream
-
notEqual
public boolean notEqual(TextField oCompare)
Compare text fields for content inequality.Compare this field against the one passed on the parameter oCompare for content inequality. The graphics sources of the fields are not compared. This is the exact opposite of the equality comparison.
- Parameters:
oCompare
- Field to compare against- Returns:
- TRUE if the fields are unequal; FALSE otherwise.
-
isEqual
public boolean isEqual(TextField oCompare)
Overridable equality comparison.Compare this field against the one passed on the parameter oCompare for equality. The default implementation simply defers to operator==(). If you derive a class from this, you can do your own comparisons.
- Parameters:
oCompare
- Field to compare against- Returns:
- TRUE if the fields are equal; FALSE otherwise.
-
cloneField
public TextField cloneField()
Overridable method to create a new instance.When the caller works with a derived class, it must provide an implementation of Clone() that at least creates a new field of the correct (derived) type. This will be invoked by the parent stream when the caller adds one of its fields to the stream, in order to create the copy that the parent stream holds on to. The default implementation creates a copy of the field class through the copy constructor.
- Returns:
- Pointer to cloned copy. Note that this is a true clone that copies all attributes of this field, as opposed to creating an empty new instance.
-
position
public TextPosn position()
Return the position of this field in the parent stream.This method is inherited from class TextStream. The implementation in Text Field returns a pointer to a position object that allows the caller to determine the parent stream and the position within that stream. Derived classes need not override this method.
- Overrides:
position
in classTextStream
- Returns:
- Pointer to a const text position object that represents this field's position in its parent stream. If the field object is not embedded in any stream, the method returns NULL.
-
setEmbedMode
public void setEmbedMode(int eEmbedMode)
-
getEmbedMode
public int getEmbedMode()
-
setEmbedType
public void setEmbedType(int eEmbedType)
-
getEmbedType
public int getEmbedType()
-
setExpression
public void setExpression(java.lang.String sExpression)
-
getExpression
public java.lang.String getExpression()
-
-