Class TextRegion


  • public class TextRegion
    extends TextDispStr
    A text region is a displayable stream (see class TextDispStr) that has both minimum and maximum height and width. The region's graphical footprint will occupy at least its minimum height and width. Text content may caus it to grow to its maximums, but never larger. If the text exceeds the space available, scrolling may be required or displayed content may be truncated. The application may change the minimum and maximum dimensions through method calls, causing the region to be redisplayed if a text display has already been created.
    • Constructor Detail

      • TextRegion

        public TextRegion()
        Default constructor.

        The text stream contains no content and has no pool/mapping assocotiation. The minimum and maximum width and height are all defaulted to one inch.

      • TextRegion

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

        Create a text stream whose initial content is copied from the given string. The minimum and maximum width and height are all defaulted to one inch. 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

      • getMinWidth

        public UnitSpan getMinWidth()
        Return the minimum width of the text region.

        This provides the same information as the virtual MinWidth() method in the base class, TextDispStr.

        Returns:
        Minimum width of the text region. For information on special values, please see the base class (TextDispStr) documentation.
      • setMinWidth

        public void setMinWidth​(UnitSpan oNewWidth)
        Set the minimum width of the text region.

        This method allows the caller to change the minimum width of the text region, possibly triggering a redisplay.

        Parameters:
        oNewWidth - - New minimum width of the text region. For information on special values, please see the base class (TextDispStr) documentation.
      • getMinHeight

        public UnitSpan getMinHeight()
        Return the minimum height of the text region.

        This provides the same information as the virtual Minheight() method in the base class, TextDispStr.

        Returns:
        Minimum height of the text region. For information on special values, please see the base class (TextDispStr) documentation.
      • setMinHeight

        public void setMinHeight​(UnitSpan oNewHeight)
        Set the minimum height of the text region.

        This method allows the caller to change the minimum height of the text region, possibly triggering a redisplay.

        Parameters:
        oNewHeight - - New minimum height of the text region. For information on special values, please see the base class (TextDispStr) documentation.
      • getMaxWidth

        public UnitSpan getMaxWidth()
        Return the maximum width of the text region.

        This provides the same information as the virtual MaxWidth() method in the base class, TextDispStr.

        Returns:
        Maximum width of the text region. For information on special values, please see the base class (TextDispStr) documentation.
      • setMaxWidth

        public void setMaxWidth​(UnitSpan oNewWidth)
        Set the maximum width of the text region.

        This method allows the caller to change the maximum width of the text region, possibly triggering a redisplay.

        Parameters:
        oNewWidth - - New maximum width of the text region. For information on special values, please see the base class (TextDispStr) documentation.
      • getMaxHeight

        public UnitSpan getMaxHeight()
        Return the maximum height of the text region.

        This provides the same information as the virtual Maxheight() method in the base class, TextDispStr.

        Returns:
        Maximum height of the text region. For information on special values, please see the base class (TextDispStr) documentation.
      • setMaxHeight

        public void setMaxHeight​(UnitSpan oNewHeight)
        Set the maximum height of the text region.

        This method allows the caller to change the maximum height of the text region, possibly triggering a redisplay.

        Parameters:
        oNewHeight - - New maximum height of the text region. For information on special values, please see the base class (TextDispStr) documentation.
      • setJustifyHeight

        public void setJustifyHeight​(UnitSpan oJustifyHeight)
        Set the justfiy height of the text region.

        This method sets the height to use during justification calculations

      • setJustifyWidth

        public void setJustifyWidth​(UnitSpan oJustifyWidth)
        Set the justfiy width of the text region.

        This method sets the height to use during justification calculations

      • setJustifyExtents

        public void setJustifyExtents​(UnitSpan oJustifyWidth,
                                      UnitSpan oJustifyHeight)
        Set the justfiy extents of the text region.

        This method sets the height to use during justification calculations

      • enforceSize

        public boolean enforceSize()
        Query whether the stream enforces text region size at data entry time.

        Returns:
        TRUE if the graphical size is being enforced; FALSE if not. Note that the constructor defaults this to TRUE.
      • enforceSize

        public void enforceSize​(boolean bNewEnforce)
        Change the value of the EnforceSize flag.

        Parameters:
        bNewEnforce - - TRUE causes the text region to respect its maximum size; FALSE allows the text content to exceed the maximum size of the region. Note that the constructor defaults this to TRUE.
      • copyFrom

        public void copyFrom​(TextRegion oSource)
        Assign this text region's content from the given text region.

        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 service and attributes will be re-pooled in any attribute pool associated with this stream. The minimum and maximum width and height of the source stream are also copied. The display pointer is not copied, as each stream has its own display; nor is a display automatically created.

        Parameters:
        oSource - - Stream containing source content to copy.
      • equals

        public boolean equals​(java.lang.Object object)
        Compare text regions for equality.

        Compare this stream against the one passed on the parameter oCompare for 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. The display does not participate in the comparison. In addition, the text regions' minimum and maximum width and height must match.

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

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

        Compare this stream against the one passed on the parameter oCompare for 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.

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