Class SegmentBuilder

java.lang.Object
org.omegat.gui.editor.SegmentBuilder

public class SegmentBuilder extends 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.
  • Field Details

  • Constructor Details

  • Method Details

    • isDefaultTranslation

      public boolean isDefaultTranslation()
    • setDefaultTranslation

      public void setDefaultTranslation(boolean defaultTranslation)
    • createSegmentElement

      public void createSegmentElement(boolean isActive, TMXEntry trans)
      Create an element for one segment.
      Parameters:
      isActive - flag to indicate activeness
      trans - translation entry
    • createSegmentElement

      public void createSegmentElement(boolean isActive, TMXEntry trans, boolean defaultTranslation)
      Create an element for one segment.
      Parameters:
      isActive - flag to indicate activeness
      trans - translation entry
      defaultTranslation - flag to indicate it is a default translation
    • 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)
    • getSourceTextEntry

      public SourceTextEntry getSourceTextEntry()
    • getDisplayVersion

      public long getDisplayVersion()
    • isActive

      public boolean isActive()
    • getSourceText

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

      public @Nullable 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 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()