Class TextDispStr

  • Direct Known Subclasses:
    TextLabel, TextRegion

    public class TextDispStr
    extends TextSparseStream
    This class represents a text stream (see class jfTextStream) that can be displayed. In order to display a stream, AXTE must perform a text layout to do word wrapping, justification, and so on. This abstract base class class extends jfTextStream, serving as the base class for the concrete displayable stream classes: jfTextBlock, jfTextLabel and jfTextRegion.

    The layout actually happens through a companion class, jfTextDisplay. When the application needs to perform layout-related operations, it calls the Createdisplay() method. The first call for a jfTextDispStr instance will create the companion display object; subsequent calls simply return a pointer to the already created display.

    Note that there are a number of operations on other text classes that may not work until the display exists. For example, caret/position translation and vertical movement.

    • Constructor Detail

      • TextDispStr

        public TextDispStr()
        Default constructor.

        The text stream contains no content and has no pool/mapping assocotiation. The display is not automatically created.

      • TextDispStr

        public TextDispStr​(TextDispStr oSource)
        Copy constructor.

        Copy all stream content from the source stream. The display is not automatically created.

        Parameters:
        oSource - - Source stream to copy content from.
      • TextDispStr

        public TextDispStr​(java.lang.String sSource)
        Constructor with source text string.

        Create a text stream whose initial content is copied from the given string. The text stream initially has no attribute pool association. The display is not automatically created.

        Parameters:
        sSource - - String whose contents are to be copied to the text stream.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object object)
        Description copied from class: TextStream
        Compare text streams for content equality.

        Compare this stream against the one passed on the parameter oCompare for content equality. The graphics sources of the streams are not compared. To be equal, the streams' content must match in all aspects: raw text, attributes, embedded field content, and so on.

        Overrides:
        equals in class TextStream
        Parameters:
        object - Text Stream object to compare against
        Returns:
        TRUE if the streams are equal; FALSE otherwise.
      • extent

        public Rect extent()
        Query the graphical extent of the text.

        This method returns the graphical extent of the text as a rectangle. This extent is defined as the minimum of the text's graphical size and the maximum graphical size (see below) of the displayable stream. For example, consider a text block with a small amount of text. The returned value will be the size of the text block. If that block's text grows to the point where scrolling is requied, the returned value will be the total graphical extent of all of the block's text.

        Returns:
        A rectangle indicating the extent of the text. Note that the extent includes justification but not scroll offsets. For example, a small amount of right-aligned text means that the left side of the returned rectangle will be non-zero. If the text is so large that there is a vertical scroll bar, the top will be zero even if the vertical alignment is bottom.
      • runtimeExtent

        public Rect runtimeExtent()
        Query the extent of the underlying text.

        This likely exists for historical reasons only. It simply returns the same extent as the Extent() method. In some (but not all) cases, it will create the display for the caller. return A rectangle indicating the extent of the text.

      • allowOverflow

        public boolean allowOverflow()
        Query whether the displayable stream allows horizontal overflow.

        A displayable stream can be told to restrict its content horizontally to the graphical space alotted, or to allow the content to overflow (effectively turning off word-wrapping). This is not to be confused with the MaxSize() method of the base text stream class which restricts by number of characters. This is a legacy feature that applied to single-line text objects. There were cases where the graphical space wasn't quite large enough for the maximum number of characters. Allowing overflow prevented word-wrapping or scrolling.

        Returns:
        TRUE if the stream allows horizontal overflow; FALSE if not. The default is FALSE (though some displayable stream types inherently allow it).
      • allowOverflow

        public void allowOverflow​(boolean bNewAllow)
        Change the value of the AllowOverflow setting. A displayable stream can be told to restrict its content horizontally to the graphical space alotted, or to allow the content to overflow (effectively turning off word-wrapping). This is not to be confused with the MaxSize() method of the base text stream class which restricts by number of characters. This is a legacy feature that applied to single-line text objects. There were cases where the graphical space wasn't quite large enough for the maximum number of characters. Allowing overflow prevented word-wrapping or scrolling. Changing the setting will cause the stream to be redisplayed if there is a display associated.
        Parameters:
        bNewAllow - - TRUE if the stream is to allow horizontal overflow; FALSE if not (though some displayable stream types inherently allow overflow).
      • justifyVPoint

        public boolean justifyVPoint()
        Query whether vertical justification occurs at a point.

        The text label class performs vertical justification at a point. The text block and region have a nominal height. Vertical justification occurs within this height. This method asks the stream what sort of vertical justification it supports.

        Returns:
        TRUE if the stream justifies vertically at a point; FALSE if it justifies vertically within a nominal height.
      • justifyHPoint

        public boolean justifyHPoint()
        Query whether horizontal justification occurs at a point.

        The text label class performs horizontal justification at a point. The text block and region have a nominal width. Horizontal justification occurs within this width. This method asks the stream what sort of horizontal justification it supports.

        Returns:
        TRUE if the stream justifies horizontally at a point; FALSE if it justifies horizontally within a nominal width.
      • unlimitedWidth

        public boolean unlimitedWidth()
        Query whether the stream has an unlimited width.

        The text label can grow arbitrarily in X. A text region may have a maximum width, or it may allow unlimited horizontal growth. This method asks the object whether it has an unlimited width.

        Returns:
        TRUE if the width is unlimited; FALSE if there is a limit on the width.
      • unlimitedHeight

        public boolean unlimitedHeight()
        Query whether the stream has an unlimited height.

        The text label can grow arbitrarily in Y. A text region may have a maximum height, or it may allow unlimited vertical growth. This method asks the object whether it has an unlimited height.

        Returns:
        TRUE if the height is unlimited; FALSE if there is a limit on the height.
      • combCells

        public int combCells()
        Query the number of comb cells to use for comb justification.

        Comb justification requires that the number of available cells be known so that shorter text strings can be placed accordingly. This method returns the number of cells to use. If the number is zero, the stream's MaxSize() value is used. If that is also zero, the actual number of _characters_ is used. The reason for a number of cells separate from MaxSize() is because the latter counts characters and in some languages, several characters may share the same cell (e.g., for separate accent characters).

      • combCells

        public void combCells​(int nCombCells)
        Change the number of comb cells to use for comb justification.

        For more information on this attribute, please see the first overload of this method.

        Parameters:
        nCombCells - - New number of comb cells.
      • notEqual

        public boolean notEqual​(TextDispStr oCompare)
        Compare text streams for content inequality.

        Compare this stream against the one passed on the parameter oCompare for content inequality. The graphics sources of the streams are not compared. This is the exact opposite of the equality comparison. The display does not participate in the comparison. For some reason, the extent and AllowOverflow flag also do not participate in the comparison.

        Parameters:
        oCompare - - Stream to compare against
        Returns:
        TRUE if the streams are unequal; FALSE otherwise.
      • minWidth

        public UnitSpan minWidth()
        Return the stream's minimum width.

        All streams have both a minimum and maximum width, which may or may not be the same. This method returns the minimum.

        Returns:
        Minimum width allowed for the stream. A value of zero is possible, as is a value less than zero. In the latter case, it indicates that the stream is horizontally justified at a point, though callers should use the JustifyHPoint() method to test for this.
      • minHeight

        public UnitSpan minHeight()
        Return the stream's minimum height.

        All streams have both a minimum and maximum height, which may or may not be the same. This method returns the minimum. @return Minimum height allowed for the stream. A value of zero is possible, as is a value less than zero. In the latter case, it indicates that the stream is verrically justified at a point, though callers should use the JustifyVPoint() method to test for this.

        Returns:
        Minimum height of the displayable stream.
      • maxWidth

        public UnitSpan maxWidth()
        Return the stream's maximum width.

        All streams have both a minimum and maximum width, which may or may not be the same. This method returns the maximum. @return maximum width allowed for the stream. A value of zero is possible, as is a value less than zero. In the latter case, it indicates that the stream has unlimited width, though callers should use the UnlimitedWidth() method to test for this.

        Returns:
        maximum width of the displayable stream.
      • maxHeight

        public UnitSpan maxHeight()
        Return the stream's maximum height.

        All streams have both a minimum and maximum height, which may or may not be the same. This method returns the maximum. @return maximum height allowed for the stream. A value of zero is possible, as is a value less than zero. In the latter case, it indicates that the stream has unlimited height, though callers should use the Unlimitedheight() method to test for this.

        Returns:
        maximum height of the displayable stream.
      • justifyHeight

        public UnitSpan justifyHeight()
        Return the stream's justify height.

        All display streams have a notion of justify height and width which are the extents by which the justification is to take place. The default is max height however it can differ from the stream min/max sizes. Note that this value may never be set, in which case the justification uses default. Callers should call EnforceJustifyHeight() to test if a specific justification height has been set.

      • enforceJustifyHeight

        public boolean enforceJustifyHeight()
        Return TRUE if a specific height is to be used to vertically justify a stream and FALSE otherwise.
      • justifyWidth

        public UnitSpan justifyWidth()
        Return the stream's justify width.

        All display streams have a notion of justify height and width which are the extents by which the justification is to take place. This can be different from the stream min/max sizes. This value may never be set, in which case the justification uses the stream sizes. Callers should call EnforceJustifyHeight() to test if a specific justification height has been set.

      • enforceJustifyWidth

        public boolean enforceJustifyWidth()
        Return TRUE if a specific width is to be used to horizontally justify a stream and FALSE otherwise.
      • onLoadFrame

        public TextFrame onLoadFrame​(int nIndex)
        Description copied from class: TextSparseStream
        Client-implemented event handler to load a frame's content.

        The client implementation is expected to call SetFrame() or SetFrameRef() before returning.

        Specified by:
        onLoadFrame in class TextSparseStream
        Parameters:
        nIndex - - Index number of frame to load. The client can assume that the frame is currently null.
        Returns:
        Pointer to the frame that was loaded. This would be the return value of SetFrame() or the pointer passed into SetFrameRef(). The return value is for informational purposes only; the client does not increment the reference count before returning.