Class 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.

    • 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 class TextStream
        Parameters:
        object - Field to compare against
        Returns:
        TRUE if the fields are equal; FALSE otherwise.
      • 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 class TextStream
        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()