Modifier and Type | Class and Description |
---|---|
protected static class |
EditorController.HasMultipleTranslations
Class for checking if alternative translation exist.
|
IEditor.CaretPosition, IEditor.CHANGE_CASE_TO
Modifier and Type | Field and Description |
---|---|
protected int |
displayedEntryIndex
Current active segment in current file, if there are segments in file (can be fale if filter active!)
|
protected int |
displayedFileIndex
Current displayed file.
|
protected EditorTextArea3 |
editor
Editor instance.
|
protected int |
firstLoaded |
protected java.awt.Font |
font |
protected int |
lastLoaded |
protected javax.swing.Timer |
lazyLoadTimer |
protected SegmentBuilder[] |
m_docSegList
Currently displayed segments info.
|
protected MarkerController |
markerController
Class for process marks for editor.
|
protected MainWindow |
mw |
protected int |
previousDisplayedFileIndex
Current displayed file.
|
protected EditorSettings |
settings |
protected boolean |
sourceLangIsRTL |
protected boolean |
targetLangIsRTL |
Constructor and Description |
---|
EditorController(MainWindow mainWindow) |
Modifier and Type | Method and Description |
---|---|
void |
activateEntry()
Activate entry for edit.
|
void |
activateEntry(IEditor.CaretPosition pos)
Activates the current entry (if available) by displaying source text and embedding displayed text in
markers.
|
void |
changeCase(IEditor.CHANGE_CASE_TO toWhat)
Change case of the selected text or if none is selected, of the current word.
|
void |
commitAndDeactivate()
Commits the translation.
|
void |
commitAndLeave()
Commits the translation and leave entry activated.
|
protected void |
deactivateWithoutCommit()
Deactivate active translation without save.
|
AlphabeticalMarkers |
getAlphabeticalMarkers() |
IAutoCompleter |
getAutoCompleter()
Access the AutoCompleter
|
SourceTextEntry |
getCurrentEntry()
Get current active entry.
|
int |
getCurrentEntryNumber()
Get current active entry number.
|
java.lang.String |
getCurrentFile()
Get relative path (under
source ) of the source file
currently open in the editor. |
int |
getCurrentPositionInEntryTranslation()
Returns current caret position in the editable translation.
|
SegmentBuilder |
getCurrentSegmentBuilder() |
java.lang.String |
getCurrentTargetFile()
Get the relative path (under
target ) of the target file
corresponding to the current source file (per IEditor.getCurrentFile() ). |
java.lang.String |
getCurrentTranslation()
Returns current translation or null.
|
IEditorFilter |
getFilter()
Gets a filter for this editor, or null if filter doesn't applied.
|
Document3.ORIENTATION |
getOrientation()
returns the orientation of the document
(so we can decide what way of tag colouring we need;
if that has been fixed in an other way, this method can be removed again.).
|
int |
getPositionInEntryTranslation(int pos)
Returns the relative caret position in the editable translation for a
given absolute index into the overall editor document.
|
protected int |
getSegmentIndexAtLocation(int location) |
java.lang.String |
getSelectedText()
Get currently selected text.
|
EditorSettings |
getSettings()
Get settings instance.
|
void |
gotoEntry(int entryNum)
Goto entry with specified number.
|
void |
gotoEntry(int entryNum,
IEditor.CaretPosition pos)
Goto entry with specified number, and restore caret to specified
position.
|
void |
gotoEntry(java.lang.String srcString,
EntryKey key)
Goto entry based on a string and entry key.
|
void |
gotoEntryAfterFix(int entryNum,
java.lang.String fixedSource)
Goto entry with specified number while avoiding clobbering the tag fixes.
|
void |
gotoFile(int fileIndex)
Goto first entry in specified file.
|
void |
gotoHistoryBack()
Go to previous segment from history.
|
void |
gotoHistoryForward()
Go to next segment from history.
|
protected boolean |
goToSegmentAtLocation(int location)
Go to segment at specified location.
|
void |
insertTag(java.lang.String tag)
Inserts tag at the cursor position, probably with adding bidi control chars.
|
void |
insertText(java.lang.String text)
Inserts text at the cursor position.
|
void |
insertTextAndMark(java.lang.String text)
Inserts text at the cursor position and mark as to be changed
by the translator, i.e, background of segment should be marked
Must be called only from UI thread.
|
protected void |
loadDocument()
Displays the
Preferences.EDITOR_INITIAL_SEGMENT_LOAD_COUNT
segments surrounding the entry with index displayedEntryIndex . |
void |
markActiveEntrySource(SourceTextEntry requiredActiveEntry,
java.util.List<Mark> marks,
java.lang.String markerClassName)
All plugins can call this method for mark something in active entry.
|
void |
nextEntry()
Move to next entry.
|
void |
nextEntryWithNote()
Finds the next entry with a non-empty note.
|
void |
nextTranslatedEntry()
Finds the next translated entry in the document.
|
void |
nextUniqueEntry()
Find the next unique entry.
|
void |
nextUntranslatedEntry()
Finds the next untranslated entry in the document.
|
void |
prevEntry()
Move to previous entry.
|
void |
prevEntryWithNote()
Finds the previous entry with a non-empty note.
|
void |
redo()
Redo editing.
|
void |
refreshEntries(java.util.Set<java.lang.Integer> entryNumbers)
Refresh some entries.
|
void |
refreshView(boolean doCommit) |
void |
refreshViewAfterFix(java.util.List<java.lang.Integer> fixedEntries)
Refresh the current editor view while avoiding clobbering any tag fixes.
|
void |
registerEmptyTranslation()
Register as empty.
|
void |
registerIdenticalTranslation()
Register translation to be identical to source.
|
void |
registerPopupMenuConstructors(int priority,
IPopupMenuConstructor constructor)
Register constructor of popup menu.
|
void |
registerUntranslated()
Register untranslated.
|
void |
remarkOneMarker(java.lang.String markerClassName)
Calls specified marker for reprocess all entries.
|
void |
removeFilter()
Removes the current filter.
|
void |
replaceEditText(java.lang.String text)
Replaces the entire edit area with a given text.
|
void |
replaceEditTextAndMark(java.lang.String text)
Inserts text at the cursor position and mark as to be changed
by the translator, i.e, background of segment should be marked
Must be called only from UI thread.
|
void |
replacePartOfText(java.lang.String text,
int start,
int end) |
void |
requestFocus()
Set current focus to editor.
|
void |
setAlternateTranslationForCurrentEntry(boolean alternate)
Set default/alternate translation for current entry.
|
void |
setCaretPosition(IEditor.CaretPosition pos) |
void |
setFilter(IEditorFilter filter)
Sets a filter to this editor.
|
void |
showStat()
Calculate statistic for file, request statistic for project and display in status bar.
|
protected void |
toggleOrientation()
Toggle component orientation: LTR, RTL, language dependent.
|
void |
undo()
Undo editing.
|
void |
windowDeactivated()
Perform any necessary actions for window deactivation.
|
protected final EditorTextArea3 editor
protected MarkerController markerController
protected final MainWindow mw
protected SegmentBuilder[] m_docSegList
protected int firstLoaded
protected int lastLoaded
protected javax.swing.Timer lazyLoadTimer
protected int displayedFileIndex
protected int previousDisplayedFileIndex
protected int displayedEntryIndex
protected final EditorSettings settings
protected java.awt.Font font
protected boolean sourceLangIsRTL
protected boolean targetLangIsRTL
public EditorController(MainWindow mainWindow)
protected void toggleOrientation()
public Document3.ORIENTATION getOrientation()
public void requestFocus()
requestFocus
in interface IEditor
public SourceTextEntry getCurrentEntry()
getCurrentEntry
in interface IEditor
public SegmentBuilder getCurrentSegmentBuilder()
public java.lang.String getCurrentFile()
source
) of the source file
currently open in the editor.
Can be called from any thread.
getCurrentFile
in interface IEditor
public java.lang.String getCurrentTargetFile()
IEditor
target
) of the target file
corresponding to the current source file (per IEditor.getCurrentFile()
).
This file is what is created upon doing Create Target Documents, but it
may not exist yet.
Can be called from any thread.
getCurrentTargetFile
in interface IEditor
protected void loadDocument()
Preferences.EDITOR_INITIAL_SEGMENT_LOAD_COUNT
segments surrounding the entry with index displayedEntryIndex
.public void activateEntry()
IEditor
activateEntry
in interface IEditor
public void activateEntry(IEditor.CaretPosition pos)
Also moves document focus to current entry, and makes sure fuzzy info displayed if available.
public void showStat()
protected boolean goToSegmentAtLocation(int location)
location
- locationprotected int getSegmentIndexAtLocation(int location)
public void refreshEntries(java.util.Set<java.lang.Integer> entryNumbers)
public void commitAndDeactivate()
Since 1.6: Translation equal to source may be validated as OK translation if appropriate option is set in Workflow options dialog.
All displayed segments with the same source text updated also.
commitAndDeactivate
in interface IEditor
protected void deactivateWithoutCommit()
public void commitAndLeave()
commitAndLeave
in interface IEditor
public void nextEntry()
IEditor
public void prevEntry()
IEditor
public void nextUntranslatedEntry()
nextUntranslatedEntry
in interface IEditor
public void nextTranslatedEntry()
nextTranslatedEntry
in interface IEditor
public void nextEntryWithNote()
nextEntryWithNote
in interface IEditor
public void prevEntryWithNote()
prevEntryWithNote
in interface IEditor
public void nextUniqueEntry()
nextUniqueEntry
in interface IEditor
public int getCurrentEntryNumber()
getCurrentEntryNumber
in interface IEditor
public void gotoFile(int fileIndex)
public void gotoEntry(int entryNum)
IEditor.gotoEntry(int, CaretPosition)
where the caret position will be
the start of the entry.public void gotoEntry(int entryNum, IEditor.CaretPosition pos)
IEditor
public void gotoEntry(java.lang.String srcString, EntryKey key)
IEditor
public void gotoEntryAfterFix(int entryNum, java.lang.String fixedSource)
IEditor
gotoEntryAfterFix
in interface IEditor
entryNum
- entry number, starts from 1fixedSource
- The source of the entry that was fixed
Must be called only from UI thread.public void refreshViewAfterFix(java.util.List<java.lang.Integer> fixedEntries)
IEditor
refreshViewAfterFix
in interface IEditor
fixedEntries
- A list of all entries that were altered
Must be called only from UI thread.public void refreshView(boolean doCommit)
refreshView
in interface IEditor
public void changeCase(IEditor.CHANGE_CASE_TO toWhat)
changeCase
in interface IEditor
toWhat
- : lower, title, upper or cyclepublic void replaceEditText(java.lang.String text)
replaceEditText
in interface IEditor
public void replacePartOfText(java.lang.String text, int start, int end)
public void replaceEditTextAndMark(java.lang.String text)
replaceEditTextAndMark
in interface IEditor
public java.lang.String getCurrentTranslation()
IEditor
getCurrentTranslation
in interface IEditor
public int getCurrentPositionInEntryTranslation()
public int getPositionInEntryTranslation(int pos)
public void setCaretPosition(IEditor.CaretPosition pos)
public void insertText(java.lang.String text)
insertText
in interface IEditor
public void insertTextAndMark(java.lang.String text)
insertTextAndMark
in interface IEditor
text
- The text to insertpublic void insertTag(java.lang.String tag)
IEditor
public void gotoHistoryBack()
gotoHistoryBack
in interface IEditor
public void gotoHistoryForward()
gotoHistoryForward
in interface IEditor
public EditorSettings getSettings()
getSettings
in interface IEditor
public void undo()
public void redo()
public java.lang.String getSelectedText()
getSelectedText
in interface IEditor
public void remarkOneMarker(java.lang.String markerClassName)
remarkOneMarker
in interface IEditor
public void markActiveEntrySource(SourceTextEntry requiredActiveEntry, java.util.List<Mark> marks, java.lang.String markerClassName)
markActiveEntrySource
in interface IEditor
requiredActiveEntry
- entry which should be active. If user moved to other entry,
then marks will be skippedmarks
- list of marksmarkerClassName
- marker's class namepublic void registerPopupMenuConstructors(int priority, IPopupMenuConstructor constructor)
IEditor
registerPopupMenuConstructors
in interface IEditor
priority
- priority of process orderconstructor
- constructor instancepublic IEditorFilter getFilter()
IEditor
public void setFilter(IEditorFilter filter)
public void removeFilter()
removeFilter
in interface IEditor
public void setAlternateTranslationForCurrentEntry(boolean alternate)
setAlternateTranslationForCurrentEntry
in interface IEditor
public void registerUntranslated()
IEditor
registerUntranslated
in interface IEditor
public void registerEmptyTranslation()
IEditor
registerEmptyTranslation
in interface IEditor
public void registerIdenticalTranslation()
IEditor
registerIdenticalTranslation
in interface IEditor
public void windowDeactivated()
IEditor
windowDeactivated
in interface IEditor
public AlphabeticalMarkers getAlphabeticalMarkers()
public IAutoCompleter getAutoCompleter()
IEditor
getAutoCompleter
in interface IEditor