public class SegmentBuilder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
activeTranslationBeginOffset
Offset of first c.q.
|
protected int |
activeTranslationEndOffset
Offset of first c.q.
|
protected javax.swing.text.Position |
beginPosP1
Boundary of full entry display.
|
static java.lang.String |
BIDI_LRM |
static char |
BIDI_LRM_CHAR |
static java.lang.String |
BIDI_RLM |
static char |
BIDI_RLM_CHAR |
protected javax.swing.text.Position |
endPosM1
Boundary of full entry display.
|
protected boolean |
hasRTL
True if source OR target languages is RTL.
|
protected MarkerController.MarkInfo[][] |
marks
Markers for this segment.
|
protected int |
offset
current offset in document to insert new stuff
|
protected javax.swing.text.Position |
posSourceBeg
Source start position - for marks.
|
protected int |
posSourceLength |
protected javax.swing.text.Position |
posTranslationBeg
Translation start position - for marks.
|
protected int |
posTranslationLength |
static java.lang.String |
SEGMENT_MARK_ATTRIBUTE
Attributes for show text.
|
static java.lang.String |
SEGMENT_SPELL_CHECK |
Constructor and Description |
---|
SegmentBuilder(EditorController controller,
Document3 doc,
EditorSettings settings,
SourceTextEntry ste,
int segmentNumberInProject,
boolean hasRTL) |
Modifier and Type | Method and Description |
---|---|
void |
addSegmentSeparator()
Add separator between segments - one empty line.
|
void |
addSegmentSeparator(int index) |
javax.swing.text.AttributeSet |
attrs(boolean isSource,
boolean isPlaceholder,
boolean isRemoveText,
boolean isNBSP)
Choose segment part attributes based on rules.
|
void |
createSegmentElement(boolean isActive,
int initialOffset,
TMXEntry trans,
boolean defaultTranslation) |
void |
createSegmentElement(boolean isActive,
TMXEntry trans)
Create element for one segment.
|
void |
createSegmentElement(boolean isActive,
TMXEntry trans,
boolean defaultTranslation) |
long |
getDisplayVersion() |
int |
getEndPosition()
Get segment's end position.
|
java.lang.String |
getSourceText()
Get source text of entry with internal bidi chars, or null if not displayed.
|
SourceTextEntry |
getSourceTextEntry() |
int |
getStartPosition()
Get segment's start position.
|
int |
getStartSourcePosition() |
int |
getStartTranslationPosition() |
java.lang.String |
getTranslationText()
Get translation text of entry with internal bidi chars, or null if not displayed.
|
boolean |
hasBeenCreated() |
boolean |
isActive() |
boolean |
isDefaultTranslation() |
boolean |
isInsideSegment(int location)
Check if location inside segment.
|
void |
prependSegmentElement(boolean isActive,
TMXEntry trans) |
void |
prependSegmentSeparator() |
void |
resetTextAttributes() |
void |
setDefaultTranslation(boolean defaultTranslation) |
public static final java.lang.String SEGMENT_MARK_ATTRIBUTE
public static final java.lang.String SEGMENT_SPELL_CHECK
public static final java.lang.String BIDI_LRM
public static final java.lang.String BIDI_RLM
public static final char BIDI_LRM_CHAR
public static final char BIDI_RLM_CHAR
protected int activeTranslationBeginOffset
protected int activeTranslationEndOffset
protected javax.swing.text.Position beginPosP1
protected javax.swing.text.Position endPosM1
protected javax.swing.text.Position posSourceBeg
protected int posSourceLength
protected javax.swing.text.Position posTranslationBeg
protected int posTranslationLength
protected int offset
protected MarkerController.MarkInfo[][] marks
protected final boolean hasRTL
public SegmentBuilder(EditorController controller, Document3 doc, EditorSettings settings, SourceTextEntry ste, int segmentNumberInProject, boolean hasRTL)
public boolean isDefaultTranslation()
public void setDefaultTranslation(boolean defaultTranslation)
public void createSegmentElement(boolean isActive, TMXEntry trans)
doc
- documentpublic void createSegmentElement(boolean isActive, TMXEntry trans, boolean defaultTranslation)
public void prependSegmentElement(boolean isActive, TMXEntry trans)
public void createSegmentElement(boolean isActive, int initialOffset, TMXEntry trans, boolean defaultTranslation)
public boolean hasBeenCreated()
public void addSegmentSeparator()
public void prependSegmentSeparator()
public void addSegmentSeparator(int index)
public SourceTextEntry getSourceTextEntry()
public long getDisplayVersion()
public boolean isActive()
public java.lang.String getSourceText()
public java.lang.String getTranslationText()
public int getStartSourcePosition()
public int getStartTranslationPosition()
public int getStartPosition()
public int getEndPosition()
public boolean isInsideSegment(int location)
public javax.swing.text.AttributeSet attrs(boolean isSource, boolean isPlaceholder, boolean isRemoveText, boolean isNBSP)
isSource
- is it a source segment or a target segmentisPlaceholder
- 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?public void resetTextAttributes()