Class SegmentBuilder


  • public class SegmentBuilder
    extends java.lang.Object
    Class for store information about displayed segment, and for show segment in editor. RTL and Bidirectional support: see good description at http://www.iamcal.com/understanding-bidirectional-text/. Java support of RTL/bidi depends on supported Unicode version. You can usually find supported Unicode version in the Character class comments.
    • Method Detail

      • isDefaultTranslation

        public boolean isDefaultTranslation()
      • setDefaultTranslation

        public void setDefaultTranslation​(boolean defaultTranslation)
      • createSegmentElement

        public void createSegmentElement​(boolean isActive,
                                         TMXEntry trans)
        Create element for one segment.
        Parameters:
        doc - document
      • createSegmentElement

        public void createSegmentElement​(boolean isActive,
                                         TMXEntry trans,
                                         boolean defaultTranslation)
      • prependSegmentElement

        public void prependSegmentElement​(boolean isActive,
                                          TMXEntry trans)
      • createSegmentElement

        public void createSegmentElement​(boolean isActive,
                                         int initialOffset,
                                         TMXEntry trans,
                                         boolean defaultTranslation)
      • hasBeenCreated

        public boolean hasBeenCreated()
      • addSegmentSeparator

        public void addSegmentSeparator()
        Add separator between segments - one empty line.
      • prependSegmentSeparator

        public void prependSegmentSeparator()
      • addSegmentSeparator

        public void addSegmentSeparator​(int index)
      • getDisplayVersion

        public long getDisplayVersion()
      • isActive

        public boolean isActive()
      • getSourceText

        public java.lang.String getSourceText()
        Get source text of entry with internal bidi chars, or null if not displayed.
      • getTranslationText

        public java.lang.String getTranslationText()
        Get translation text of entry with internal bidi chars, or null if not displayed.
      • getStartSourcePosition

        public int getStartSourcePosition()
      • getStartTranslationPosition

        public int getStartTranslationPosition()
      • getStartPosition

        public int getStartPosition()
        Get segment's start position.
        Returns:
        start position
      • getEndPosition

        public int getEndPosition()
        Get segment's end position.
        Returns:
        end position
      • isInsideSegment

        public boolean isInsideSegment​(int location)
        Check if location inside segment.
      • attrs

        public javax.swing.text.AttributeSet attrs​(boolean isSource,
                                                   boolean isPlaceholder,
                                                   boolean isRemoveText,
                                                   boolean isNBSP)
        Choose segment part attributes based on rules.
        Parameters:
        isSource - is it a source segment or a target segment
        isPlaceholder - is it for a placeholder (OmegaT tag or sprintf-variable etc.) or regular text inside the segment?
        isRemoveText - is it text that should be removed in the translation?
        isNBSP - is the text a non-breakable space?
        Returns:
        the attributes to format the text
      • resetTextAttributes

        public void resetTextAttributes()