├── src ├── main │ ├── resources │ │ ├── conf │ │ │ ├── last-session.json │ │ │ ├── ocelot_cfg.json │ │ │ ├── rules.properties │ │ │ └── lqi_cfg.json │ │ ├── build │ │ │ └── appbundler-1.0ea.jar │ │ ├── com │ │ │ └── vistatec │ │ │ │ └── ocelot │ │ │ │ ├── add.png │ │ │ │ ├── pin.png │ │ │ │ ├── find.png │ │ │ │ ├── logo.ico │ │ │ │ ├── mac.icns │ │ │ │ ├── arrow-up.png │ │ │ │ ├── delete.png │ │ │ │ ├── disabled.png │ │ │ │ ├── enabled.png │ │ │ │ ├── logo64.png │ │ │ │ ├── settings.png │ │ │ │ ├── arrow-down.png │ │ │ │ ├── change-dir.png │ │ │ │ ├── link-disabled.png │ │ │ │ ├── link-enabled.png │ │ │ │ ├── term-disabled.png │ │ │ │ ├── term-enabled.png │ │ │ │ ├── entity-disabled.png │ │ │ │ ├── entity-enabled.png │ │ │ │ ├── entity-enabled.old.png │ │ │ │ ├── link-disabled.old.png │ │ │ │ ├── link-enabled.old.png │ │ │ │ ├── lqi │ │ │ │ └── gui │ │ │ │ │ └── window │ │ │ │ │ ├── add.png │ │ │ │ │ ├── ok.png │ │ │ │ │ ├── arrow-up.png │ │ │ │ │ ├── remove.png │ │ │ │ │ └── arrow-down.png │ │ │ │ ├── entity-disabled.old.png │ │ │ │ ├── ic_settings_black_14px.png │ │ │ │ ├── ic_settings_white_14px.png │ │ │ │ ├── mac.iconset │ │ │ │ ├── logo_16x16.png │ │ │ │ ├── logo_32x32.png │ │ │ │ ├── logo_128x128.png │ │ │ │ ├── logo_16x16@2x.png │ │ │ │ ├── logo_256x256.png │ │ │ │ ├── logo_32x32@2x.png │ │ │ │ ├── logo_512x512.png │ │ │ │ ├── logo_128x128@2x.png │ │ │ │ ├── logo_256x256@2x.png │ │ │ │ └── logo_512x512@2x.png │ │ │ │ ├── ic_settings_black_14px@2x.png │ │ │ │ └── ic_settings_white_14px@2x.png │ │ └── log4j.properties │ └── java │ │ └── com │ │ └── vistatec │ │ └── ocelot │ │ ├── Platform.java │ │ ├── config │ │ ├── json │ │ │ ├── RootConfig.java │ │ │ ├── ProfileConfig.java │ │ │ ├── PluginConfig.java │ │ │ ├── OcelotAzureConfig.java │ │ │ ├── ProvenanceConfig.java │ │ │ ├── SpellingConfig.java │ │ │ └── LingoTekConfig.java │ │ ├── TransferException.java │ │ ├── ConfigTransferService.java │ │ ├── Configs.java │ │ ├── ConfigurationException.java │ │ ├── UserProvenance.java │ │ ├── ProfileConfigTransferService.java │ │ ├── LqiJsonConfigTransferService.java │ │ ├── OcelotJsonConfigTransferService.java │ │ ├── JsonConfigTransferService.java │ │ ├── DirectoryBasedConfigs.java │ │ └── ProfileConfigService.java │ │ ├── xliff │ │ ├── XLIFFVersion.java │ │ ├── XLIFFParser.java │ │ ├── XLIFFDocument.java │ │ ├── XLIFFWriter.java │ │ ├── XLIFFFactory.java │ │ ├── freme │ │ │ ├── EnrichmentAnnotationsConstants.java │ │ │ └── helper │ │ │ │ └── FremeXliffHelper.java │ │ └── okapi │ │ │ └── XliffDocumentConstants.java │ │ ├── events │ │ ├── api │ │ │ ├── OcelotEvent.java │ │ │ ├── OcelotEventQueueListener.java │ │ │ ├── OcelotEventQueue.java │ │ │ └── EventBusWrapper.java │ │ ├── LQIDeselectionEvent.java │ │ ├── ItsDocStatsClearEvent.java │ │ ├── ItsDocStatsChangedEvent.java │ │ ├── NewPluginsInstalled.java │ │ ├── TextAnalysisAddedEvent.java │ │ ├── PluginAddedEvent.java │ │ ├── SegmentNoteEditEvent.java │ │ ├── SegmentTargetEnterEvent.java │ │ ├── SegmentTargetExitEvent.java │ │ ├── SegmentTargetResetEvent.java │ │ ├── ConcordanceSearchEvent.java │ │ ├── ProfileChangedEvent.java │ │ ├── GoToSegmentEvent.java │ │ ├── RefreshSegmentView.java │ │ ├── SegmentRowsSortedEvent.java │ │ ├── ItsSelectionEvent.java │ │ ├── SegmentSelectionEvent.java │ │ ├── ConfigTmRequestEvent.java │ │ ├── DisplayLeftComponentEvent.java │ │ ├── ReplaceDoneEvent.java │ │ ├── ItsDocStatsAddedProvEvent.java │ │ ├── LQIEvent.java │ │ ├── ProvenanceSelectionEvent.java │ │ ├── OcelotEditingEvent.java │ │ ├── LQISelectionEvent.java │ │ ├── EnrichingStartedStoppedEvent.java │ │ ├── SegmentTargetEditEvent.java │ │ ├── ItsDocStatsUpdateLqiEvent.java │ │ ├── LQIRemoveEvent.java │ │ ├── SegmentTargetUpdateFromMatchEvent.java │ │ ├── ItsDocStatsRecalculateEvent.java │ │ ├── ItsDocStatsRemovedLqiEvent.java │ │ ├── SegmentVariantSelectionEvent.java │ │ ├── OpenFileEvent.java │ │ ├── SegmentTargetUpdateEvent.java │ │ ├── SegmentEvent.java │ │ ├── SegmentNoteUpdatedEvent.java │ │ ├── ProvenanceAddEvent.java │ │ ├── SegmentEditEvent.java │ │ ├── LQIAdditionEvent.java │ │ ├── UserProfileSaveEvent.java │ │ ├── LQIConfigurationSelectionChangedEvent.java │ │ ├── HighlightEvent.java │ │ ├── LQIEditEvent.java │ │ ├── LQIConfigurationsChangedEvent.java │ │ ├── LQIModificationEvent.java │ │ ├── EnrichmentViewEvent.java │ │ └── ReplaceEvent.java │ │ ├── rules.properties │ │ ├── plugins │ │ ├── exception │ │ │ ├── NoAuditProfileLoadedException.java │ │ │ ├── EvaluationOnTheFlyFailedException.java │ │ │ ├── QualityEvaluationException.java │ │ │ ├── UnknownServiceException.java │ │ │ ├── AuditProfileException.java │ │ │ └── FremeEnrichmentException.java │ │ ├── TimerPlugin.java │ │ ├── ReportPlugin.java │ │ ├── Plugin.java │ │ └── freme │ │ │ └── FremeEnrichmentOptions.java │ │ ├── tm │ │ ├── TmTmxWriter.java │ │ ├── TmPenalizer.java │ │ ├── TmMatch.java │ │ ├── TmService.java │ │ ├── gui │ │ │ ├── DetachableComponent.java │ │ │ ├── constants │ │ │ │ └── TmIconsConst.java │ │ │ └── match │ │ │ │ └── AlternateRowsColorRenderer.java │ │ └── penalty │ │ │ ├── PenalizedTmMatch.java │ │ │ └── SimpleTmPenalizer.java │ │ ├── spellcheck │ │ ├── LocaleNotSupportedException.java │ │ └── CheckResult.java │ │ ├── segment │ │ └── model │ │ │ ├── SegmentAtom.java │ │ │ ├── okapi │ │ │ ├── OkapiCodeAtom.java │ │ │ ├── Note.java │ │ │ ├── OffsetTaggedCodeAtom.java │ │ │ ├── Notes.java │ │ │ └── TaggedCodeAtom.java │ │ │ ├── PositionAtom.java │ │ │ ├── CodeAtom.java │ │ │ └── HighlightData.java │ │ ├── storage │ │ ├── service │ │ │ ├── util │ │ │ │ ├── AzureConsts.java │ │ │ │ └── Util.java │ │ │ └── StorageService.java │ │ └── model │ │ │ └── PostUploadRequest.java │ │ ├── lqi │ │ └── gui │ │ │ ├── TableCellListener.java │ │ │ ├── LQIGridColumn.java │ │ │ ├── ConfigurationItem.java │ │ │ ├── TableCellEvent.java │ │ │ ├── renderer │ │ │ ├── LQIGridButtonRenderer.java │ │ │ ├── TextAreaColorCellRenderer.java │ │ │ └── ColorHeaderCellRenderer.java │ │ │ ├── LQIGridButton.java │ │ │ └── editor │ │ │ └── FloatCellEditor.java │ │ ├── XliffFileFilter.java │ │ ├── profile │ │ ├── IProfileManager.java │ │ └── ProfileException.java │ │ ├── freme │ │ └── gui │ │ │ └── LDGraphFrame.java │ │ ├── services │ │ ├── XliffService.java │ │ ├── SegmentService.java │ │ ├── ProvenanceService.java │ │ └── OkapiXLIFFDocument.java │ │ ├── PlatformSupport.java │ │ ├── lgk │ │ ├── IHttpRequestService.java │ │ ├── HttpRequestService.java │ │ └── LingoTekServiceException.java │ │ ├── its │ │ ├── model │ │ │ ├── EnrichmentMetaData.java │ │ │ └── ITSMetadata.java │ │ └── stats │ │ │ └── model │ │ │ ├── TerminologyStats.java │ │ │ └── TextAnalysisStats.java │ │ ├── ui │ │ ├── TooltipCellRenderer.java │ │ ├── ODialogPanel.java │ │ ├── TableRowToggleMouseAdapter.java │ │ └── IntegerDocument.java │ │ ├── rules │ │ ├── DataCategoryFlagRenderer.java │ │ ├── RuleListener.java │ │ └── StateQualifier.java │ │ └── TextContextMenu.java ├── test │ ├── resources │ │ ├── com │ │ │ └── vistatec │ │ │ │ └── ocelot │ │ │ │ ├── config │ │ │ │ ├── test_empty_provenance.json │ │ │ │ ├── def_profile_cfg.json │ │ │ │ ├── testProfileFile.json │ │ │ │ ├── test_load_provenance.json │ │ │ │ ├── ocelot_cfg.json │ │ │ │ └── lqi_config_plain.json │ │ │ │ ├── tm │ │ │ │ └── okapi │ │ │ │ │ ├── empty.tmx │ │ │ │ │ ├── export_tmx_test_goal.tmx │ │ │ │ │ ├── export_tagged_tmx_test_goal.tmx │ │ │ │ │ ├── export_multiple_segments_tmx_test_goal.tmx │ │ │ │ │ └── simple_tm.tmx │ │ │ │ ├── segment │ │ │ │ └── view │ │ │ │ │ └── col_config.json │ │ │ │ ├── spellcheck │ │ │ │ ├── Spelling_en.xlf │ │ │ │ └── Spelling_ru.xlf │ │ │ │ ├── xliff │ │ │ │ └── okapi │ │ │ │ │ ├── test_file_xliff1.2.xlf │ │ │ │ │ ├── test_file_with_note_deleted_xliff1.2.xlf │ │ │ │ │ ├── test_file_with_note_xliff1.2.xlf │ │ │ │ │ ├── test_file_with_note_updated_xliff1.2.xlf │ │ │ │ │ ├── test_file_multiple_seg_2.0.xlf │ │ │ │ │ ├── XLIFF2.0_example.xlf │ │ │ │ │ ├── xliff1.2.not-enriched-small.xlf │ │ │ │ │ ├── file_with_notes_multiple_segm_2.0.xlf │ │ │ │ │ ├── file_with_notes_multiple_segm_updated_2.0.xlf │ │ │ │ │ ├── xliff2.0.not-enriched-small.xlf │ │ │ │ │ ├── file_single_segm_2.0.xlf │ │ │ │ │ ├── file_single_segm_with_notes_deleted2.0.xlf │ │ │ │ │ ├── file_single_segm_with_notes2.0.xlf │ │ │ │ │ └── file_single_segm_with_notes_updated2.0.xlf │ │ │ │ └── findrep │ │ │ │ └── Tiny.xlf │ │ ├── no-matchers.properties │ │ ├── statequals.properties │ │ ├── ITSPlugin-1.0-SNAPSHOT.jar │ │ ├── tool.properties │ │ ├── SegmentPlugin-1.0-SNAPSHOT.jar │ │ ├── testconfig │ │ │ ├── rules.properties │ │ │ └── ocelot_cfg.xml │ │ ├── lqi.properties │ │ ├── empty_xliff_12_with_itsVersion.xlf │ │ ├── no-its-namespace.xlf │ │ ├── test.xlf │ │ ├── gold │ │ │ ├── lqi_no_provenance.xlf │ │ │ ├── no-its-namespace.xlf │ │ │ ├── multiple-its-namespace.xlf │ │ │ └── redundant-its-namespace.xlf │ │ ├── xliff20 │ │ │ └── noTargets.xlf │ │ └── oc26.xlf │ └── java │ │ └── com │ │ └── vistatec │ │ └── ocelot │ │ ├── gui │ │ └── lqi │ │ │ └── TestLqiGridView.java │ │ ├── xliff │ │ └── okapi │ │ │ └── TestOkapiXLIFFFactory.java │ │ ├── rules │ │ └── RulesTestHelpers.java │ │ ├── TestXliffFileFilter.java │ │ ├── storage │ │ └── service │ │ │ └── util │ │ │ └── UtilTest.java │ │ ├── TestOcelotApp.java │ │ ├── config │ │ ├── TestOcelotJsonConfigTransferService.java │ │ ├── TestProfileConfigTransferService.java │ │ └── TestProfileConfig.java │ │ └── tm │ │ └── okapi │ │ └── OkapiTmTestHelpers.java └── assembly │ └── deployment.xml ├── .travis.yml ├── .gitignore └── sample_plugins └── pom.xml /src/main/resources/conf/last-session.json: -------------------------------------------------------------------------------- 1 | { 2 | "profile" : "Default", 3 | "promptMessage" : true 4 | } -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/config/test_empty_provenance.json: -------------------------------------------------------------------------------- 1 | { 2 | "userProvenance" : {} 3 | } -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/Platform.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot; 2 | 3 | public class Platform { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/config/def_profile_cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "profile" : "Default", 3 | "promptMessage" : true 4 | } -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/config/testProfileFile.json: -------------------------------------------------------------------------------- 1 | { 2 | "profile" : "Test", 3 | "promptMessage" : false 4 | } -------------------------------------------------------------------------------- /src/test/resources/no-matchers.properties: -------------------------------------------------------------------------------- 1 | myrule.flag.text = M 2 | myrule.flag.fill = #007f7f 3 | myrule.flag.border = #007f7f 4 | -------------------------------------------------------------------------------- /src/test/resources/statequals.properties: -------------------------------------------------------------------------------- 1 | mt-suggestion=#f0f0f0 2 | exact-match=#ff0000 3 | id-match=#00ff00 4 | fuzzy-match=#0000ff 5 | -------------------------------------------------------------------------------- /src/main/resources/build/appbundler-1.0ea.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/build/appbundler-1.0ea.jar -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/add.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/pin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/pin.png -------------------------------------------------------------------------------- /src/test/resources/ITSPlugin-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/test/resources/ITSPlugin-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/find.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/find.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/logo.ico -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/mac.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/mac.icns -------------------------------------------------------------------------------- /src/test/resources/tool.properties: -------------------------------------------------------------------------------- 1 | myrule.tool = Tool 2 | myrule.flag.text = M 3 | myrule.flag.fill = #007f7f 4 | myrule.flag.border = #007f7f 5 | -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/arrow-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/arrow-up.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/delete.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/disabled.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/enabled.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/logo64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/logo64.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/settings.png -------------------------------------------------------------------------------- /src/test/resources/SegmentPlugin-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/test/resources/SegmentPlugin-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/json/RootConfig.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config.json; 2 | 3 | public interface RootConfig { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/arrow-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/arrow-down.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/change-dir.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/change-dir.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/link-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/link-disabled.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/link-enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/link-enabled.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/term-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/term-disabled.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/term-enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/term-enabled.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/entity-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/entity-disabled.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/entity-enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/entity-enabled.png -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/xliff/XLIFFVersion.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.xliff; 2 | 3 | public enum XLIFFVersion { 4 | XLIFF12, 5 | XLIFF20; 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/entity-enabled.old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/entity-enabled.old.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/link-disabled.old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/link-disabled.old.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/link-enabled.old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/link-enabled.old.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/lqi/gui/window/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/lqi/gui/window/add.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/lqi/gui/window/ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/lqi/gui/window/ok.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/entity-disabled.old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/entity-disabled.old.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/ic_settings_black_14px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/ic_settings_black_14px.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/ic_settings_white_14px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/ic_settings_white_14px.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/lqi/gui/window/arrow-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/lqi/gui/window/arrow-up.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/lqi/gui/window/remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/lqi/gui/window/remove.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/mac.iconset/logo_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/mac.iconset/logo_16x16.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/mac.iconset/logo_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/mac.iconset/logo_32x32.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/ic_settings_black_14px@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/ic_settings_black_14px@2x.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/ic_settings_white_14px@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/ic_settings_white_14px@2x.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/lqi/gui/window/arrow-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/lqi/gui/window/arrow-down.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/mac.iconset/logo_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/mac.iconset/logo_128x128.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/mac.iconset/logo_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/mac.iconset/logo_16x16@2x.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/mac.iconset/logo_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/mac.iconset/logo_256x256.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/mac.iconset/logo_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/mac.iconset/logo_32x32@2x.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/mac.iconset/logo_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/mac.iconset/logo_512x512.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/mac.iconset/logo_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/mac.iconset/logo_128x128@2x.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/mac.iconset/logo_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/mac.iconset/logo_256x256@2x.png -------------------------------------------------------------------------------- /src/main/resources/com/vistatec/ocelot/mac.iconset/logo_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vistatec/ocelot/HEAD/src/main/resources/com/vistatec/ocelot/mac.iconset/logo_512x512@2x.png -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/api/OcelotEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events.api; 2 | 3 | /** 4 | * Event posted to the {@link EventQueue}. 5 | */ 6 | public interface OcelotEvent {} 7 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/rules.properties: -------------------------------------------------------------------------------- 1 | rule1.locQualityIssueType = omission 2 | rule1.locQualityIssueSeverity = 0-33 3 | rule2.locQualityIssueType = style 4 | rule2.locQualityIssueSeverity = 66-100 5 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/config/test_load_provenance.json: -------------------------------------------------------------------------------- 1 | { 2 | "userProvenance" : { 3 | "revPerson" : "A", 4 | "revOrganization" : "B", 5 | "externalReference" : "C", 6 | "langCode": "D" 7 | } 8 | } -------------------------------------------------------------------------------- /src/test/resources/testconfig/rules.properties: -------------------------------------------------------------------------------- 1 | Generic_Critical.flag.text = * 2 | Generic_Critical.flag.fill = #00ff00 3 | Generic_Critical.flag.border = #00ff00 4 | Generic_Critical.locQualityIssueSeverity = 50-100 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | # Workaround for launch4j problem, see 4 | # https://github.com/travis-ci/travis-ci/issues/5176 5 | before_install: 6 | - sudo apt-get update 7 | - sudo apt-get install lib32z1 lib32ncurses5 8 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/LQIDeselectionEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class LQIDeselectionEvent implements OcelotEvent { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ItsDocStatsClearEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class ItsDocStatsClearEvent implements OcelotEvent { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ItsDocStatsChangedEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class ItsDocStatsChangedEvent implements OcelotEvent { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/NewPluginsInstalled.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class NewPluginsInstalled implements OcelotEvent { 6 | 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/TextAnalysisAddedEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class TextAnalysisAddedEvent implements OcelotEvent { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/plugins/exception/NoAuditProfileLoadedException.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.plugins.exception; 2 | 3 | public class NoAuditProfileLoadedException extends AuditProfileException { 4 | 5 | private static final long serialVersionUID = -3469465820391396926L; 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/PluginAddedEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | /** 6 | * Event triggered when new plugins are added to Ocelot. 7 | */ 8 | public class PluginAddedEvent implements OcelotEvent { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/TransferException.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | public class TransferException extends Exception { 4 | private static final long serialVersionUID = 1L; 5 | 6 | public TransferException(Throwable cause) { 7 | super(cause); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Version.java 2 | bin 3 | doc 4 | tags 5 | *.csv 6 | .DS_Store 7 | .classpath 8 | .project 9 | .settings 10 | .metadata/** 11 | /nbproject/ 12 | nb-build.xml 13 | manifest.mf 14 | /nbbuild/ 15 | /dist/ 16 | target 17 | ocelot.log* 18 | *.csv 19 | <<<<<<< HEAD 20 | *.log 21 | ======= 22 | *.log 23 | >>>>>>> ldManual 24 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/tm/TmTmxWriter.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.tm; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | /** 7 | * Export currently open file as a TMX file for usage as a TM. 8 | */ 9 | public interface TmTmxWriter { 10 | public void exportTmx(File tmx) throws IOException; 11 | } 12 | -------------------------------------------------------------------------------- /src/test/java/com/vistatec/ocelot/gui/lqi/TestLqiGridView.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.gui.lqi; 2 | 3 | import org.netbeans.jemmy.Scenario; 4 | 5 | public class TestLqiGridView implements Scenario { 6 | 7 | @Override 8 | public int runIt(Object arg0) { 9 | // TODO Auto-generated method stub 10 | return 0; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/ConfigTransferService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | import com.vistatec.ocelot.config.json.RootConfig; 4 | 5 | public interface ConfigTransferService { 6 | 7 | public RootConfig read() throws TransferException; 8 | 9 | public void save(RootConfig config) throws TransferException; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/plugins/exception/EvaluationOnTheFlyFailedException.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.plugins.exception; 2 | 3 | public class EvaluationOnTheFlyFailedException extends 4 | QualityEvaluationException { 5 | 6 | /** 7 | * 8 | */ 9 | private static final long serialVersionUID = -1654244783038389295L; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/spellcheck/LocaleNotSupportedException.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.spellcheck; 2 | 3 | public class LocaleNotSupportedException extends Exception { 4 | 5 | public LocaleNotSupportedException(String string) { 6 | super(string); 7 | } 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/tm/TmPenalizer.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.tm; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Applies penalties to returned TM match scores to indicate a loss of 7 | * reliability in the translation match. 8 | */ 9 | public interface TmPenalizer { 10 | List applyPenalties(List matches); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/segment/model/SegmentAtom.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.segment.model; 2 | 3 | public interface SegmentAtom { 4 | /** 5 | * Length of this display data. 6 | * @return 7 | */ 8 | int getLength(); 9 | 10 | /** 11 | * This is display data. 12 | */ 13 | String getData(); 14 | 15 | String getTextStyle(); 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/lqi.properties: -------------------------------------------------------------------------------- 1 | any_50_100.flag.text = * 2 | any_50_100.flag.fill = #00ff00 3 | any_50_100.flag.border = #0000ff 4 | any_50_100.locQualityIssueSeverity = 50-100 5 | noncon_90_100.locQualityIssueType = non-conformance 6 | noncon_90_100.locQualityIssueSeverity = 90-100 7 | noncon_90_100.flag.text = * 8 | noncon_90_100.flag.fill = #ff0000 9 | noncon_90_100.flag.border = #00ff00 10 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/storage/service/util/AzureConsts.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.storage.service.util; 2 | 3 | /** 4 | * @author KatiaI 5 | * 6 | */ 7 | public class AzureConsts { 8 | 9 | public static final String PRODUCT = "Ocelot"; 10 | 11 | public static String AZURE_STORAGE_CONNECTION_STRING = "BlobEndpoint=%s;QueueEndpoint=%s;SharedAccessSignature=%s"; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/tm/okapi/empty.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 |
10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/SegmentNoteEditEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.segment.model.OcelotSegment; 4 | import com.vistatec.ocelot.xliff.XLIFFDocument; 5 | 6 | public class SegmentNoteEditEvent extends SegmentEvent { 7 | public SegmentNoteEditEvent(XLIFFDocument xliff, OcelotSegment segment) { 8 | super(xliff, segment); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/tm/TmMatch.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.tm; 2 | 3 | import com.vistatec.ocelot.segment.model.SegmentVariant; 4 | 5 | /** 6 | * Match result format from TM. 7 | */ 8 | public interface TmMatch { 9 | public String getTmOrigin(); 10 | public float getMatchScore(); 11 | 12 | public SegmentVariant getSource(); 13 | public SegmentVariant getTarget(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/lqi/gui/TableCellListener.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.lqi.gui; 2 | 3 | /** 4 | * Listener to table cell changes. 5 | */ 6 | public interface TableCellListener { 7 | 8 | /** 9 | * Handles the event a table cell has changed. 10 | * 11 | * @param e 12 | * the table cell event. 13 | */ 14 | public void cellValueChanged(TableCellEvent e); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/SegmentTargetEnterEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.segment.model.OcelotSegment; 4 | import com.vistatec.ocelot.xliff.XLIFFDocument; 5 | 6 | public class SegmentTargetEnterEvent extends SegmentEvent { 7 | public SegmentTargetEnterEvent(XLIFFDocument xliff, OcelotSegment segment) { 8 | super(xliff, segment); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/SegmentTargetExitEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.segment.model.OcelotSegment; 4 | import com.vistatec.ocelot.xliff.XLIFFDocument; 5 | 6 | public class SegmentTargetExitEvent extends SegmentEvent { 7 | public SegmentTargetExitEvent(XLIFFDocument xliff, OcelotSegment segment) { 8 | super(xliff, segment); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/SegmentTargetResetEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.segment.model.OcelotSegment; 4 | import com.vistatec.ocelot.xliff.XLIFFDocument; 5 | 6 | public class SegmentTargetResetEvent extends SegmentEvent { 7 | public SegmentTargetResetEvent(XLIFFDocument xliff, OcelotSegment segment) { 8 | super(xliff, segment); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ConcordanceSearchEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class ConcordanceSearchEvent implements OcelotEvent { 6 | 7 | private String text; 8 | 9 | public ConcordanceSearchEvent(final String text) { 10 | this.text = text; 11 | } 12 | 13 | public String getText(){ 14 | return text; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ProfileChangedEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class ProfileChangedEvent implements OcelotEvent { 6 | 7 | private String profile; 8 | 9 | public ProfileChangedEvent(String profile) { 10 | 11 | this.profile = profile; 12 | } 13 | 14 | public String getProfile(){ 15 | return profile; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/Configs.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | import java.io.IOException; 4 | import java.io.Reader; 5 | import java.io.Writer; 6 | 7 | /** 8 | * Interface to abstract out the storage of the various 9 | * Ocelot config files. 10 | */ 11 | public interface Configs { 12 | 13 | Reader getRulesReader() throws IOException; 14 | 15 | Writer getRulesWriter() throws IOException; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/plugins/exception/QualityEvaluationException.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.plugins.exception; 2 | 3 | public class QualityEvaluationException extends Exception { 4 | 5 | private static final long serialVersionUID = 5408748417345947314L; 6 | 7 | public QualityEvaluationException() { 8 | } 9 | 10 | public QualityEvaluationException(Throwable cause) { 11 | 12 | super(cause); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/storage/service/StorageService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.storage.service; 2 | 3 | /** 4 | * @author KatiaI 5 | * 6 | */ 7 | public interface StorageService { 8 | 9 | public boolean uploadFileToBlobStorage(String filePath, String prefix, String fileId, String fileName); 10 | public boolean sendMessageToPostUploadQueue(String message); 11 | public boolean pickMessageFromPostUploadQueue(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/GoToSegmentEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class GoToSegmentEvent implements OcelotEvent { 6 | 7 | private int segmentNumber; 8 | 9 | public GoToSegmentEvent(int segmentNumber) { 10 | this.segmentNumber = segmentNumber; 11 | } 12 | 13 | public int getSegmentNuber(){ 14 | return segmentNumber; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/XliffFileFilter.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot; 2 | 3 | import java.io.File; 4 | import java.io.FilenameFilter; 5 | 6 | public class XliffFileFilter implements FilenameFilter { 7 | @Override 8 | public boolean accept(File dir, String name) { 9 | name = name.toLowerCase(); 10 | return name.endsWith(".xlf") || name.endsWith(".xliff") || 11 | name.endsWith(".sdlxliff"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/tm/okapi/export_tmx_test_goal.tmx: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | plain text 5 | target plain text 6 | 7 | 8 |
9 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/RefreshSegmentView.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class RefreshSegmentView implements OcelotEvent { 6 | 7 | private int segmentNumber; 8 | 9 | public RefreshSegmentView(final int segmentNumber) { 10 | 11 | this.segmentNumber = segmentNumber; 12 | } 13 | 14 | public int getSegmentNumber() { 15 | return segmentNumber; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/profile/IProfileManager.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.profile; 2 | 3 | import java.util.List; 4 | 5 | public interface IProfileManager { 6 | 7 | public List getProfiles() ; 8 | 9 | public String getActiveProfile(); 10 | 11 | public void changeProfile(String selProfile) throws ProfileException; 12 | 13 | public void restoreOldProfile(String oldProfile, String newProfile, boolean deleteFolders) throws ProfileException; 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/empty_xliff_12_with_itsVersion.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/SegmentRowsSortedEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class SegmentRowsSortedEvent implements OcelotEvent { 6 | 7 | private int[] sortedIndexMap; 8 | 9 | public SegmentRowsSortedEvent(int[] sortedIndexMap) { 10 | 11 | this.sortedIndexMap = sortedIndexMap; 12 | } 13 | 14 | public int[] getSortedIndexMap(){ 15 | return sortedIndexMap; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/segment/view/col_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "layout" : { 3 | "showTranslations" : false, 4 | "showAttrsView" : false, 5 | "showDetailsView" : false, 6 | "segmentsGrid" : { 7 | "showSegNum" : true, 8 | "showSource" : true, 9 | "showTarget" : true, 10 | "showOriginalTarget" : true, 11 | "showNotes" : false, 12 | "showEditDist" : false, 13 | "showFlags" : [ true, true, true, true, true ] 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ItsSelectionEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.its.model.ITSMetadata; 5 | 6 | public class ItsSelectionEvent implements OcelotEvent { 7 | private final ITSMetadata its; 8 | public ItsSelectionEvent(ITSMetadata its) { 9 | this.its = its; 10 | } 11 | 12 | public ITSMetadata getITSMetadata() { 13 | return its; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/SegmentSelectionEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.segment.model.OcelotSegment; 4 | import com.vistatec.ocelot.xliff.XLIFFDocument; 5 | 6 | /** 7 | * Signals that a segment has been selected in the UI. 8 | */ 9 | public class SegmentSelectionEvent extends SegmentEvent { 10 | public SegmentSelectionEvent(XLIFFDocument xliff, OcelotSegment segment) { 11 | super(xliff, segment); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/tm/TmService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.tm; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | 6 | import com.vistatec.ocelot.segment.model.SegmentAtom; 7 | 8 | /** 9 | * Service for utilizing TMs. 10 | */ 11 | public interface TmService { 12 | public List getFuzzyTermMatches(List segment) throws IOException; 13 | 14 | public List getConcordanceMatches(List segment) throws IOException; 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ConfigTmRequestEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import java.awt.Window; 4 | 5 | import com.vistatec.ocelot.events.api.OcelotEvent; 6 | 7 | public class ConfigTmRequestEvent implements OcelotEvent { 8 | 9 | private Window currentWindow; 10 | public ConfigTmRequestEvent(final Window currentWindow) { 11 | 12 | this.currentWindow = currentWindow; 13 | } 14 | 15 | public Window getCurrentWindow(){ 16 | return currentWindow; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/DisplayLeftComponentEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import java.awt.Component; 4 | 5 | import com.vistatec.ocelot.events.api.OcelotEvent; 6 | 7 | public class DisplayLeftComponentEvent implements OcelotEvent { 8 | 9 | private Component component; 10 | 11 | public DisplayLeftComponentEvent(Component component) { 12 | 13 | this.component = component; 14 | } 15 | 16 | public Component getComponent() { 17 | return component; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/xliff/XLIFFParser.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.xliff; 2 | 3 | import com.vistatec.ocelot.segment.model.OcelotSegment; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.util.List; 8 | 9 | public interface XLIFFParser { 10 | public List parse(File xliffFile) throws IOException; 11 | 12 | public String getSourceLang(); 13 | 14 | public String getTargetLang(); 15 | 16 | public String getOriginalFileName(); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ReplaceDoneEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class ReplaceDoneEvent implements OcelotEvent { 6 | 7 | private int replacedOccurrencesNum; 8 | 9 | public ReplaceDoneEvent( int replacedOccurrencesNum) { 10 | 11 | this.replacedOccurrencesNum = replacedOccurrencesNum; 12 | } 13 | 14 | public int getReplacedOccurrencesNum(){ 15 | return replacedOccurrencesNum; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/ConfigurationException.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | public class ConfigurationException extends Exception { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = -7856870594746380101L; 9 | 10 | public ConfigurationException(String message, Throwable cause) { 11 | super(message, cause); 12 | } 13 | 14 | public ConfigurationException(String message) { 15 | super(message); 16 | } 17 | 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ItsDocStatsAddedProvEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.its.model.Provenance; 5 | 6 | public class ItsDocStatsAddedProvEvent implements OcelotEvent { 7 | private final Provenance prov; 8 | 9 | public ItsDocStatsAddedProvEvent(Provenance prov) { 10 | this.prov = prov; 11 | } 12 | 13 | public Provenance getProv() { 14 | return prov; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/LQIEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.its.model.LanguageQualityIssue; 5 | 6 | public abstract class LQIEvent implements OcelotEvent { 7 | private final LanguageQualityIssue lqi; 8 | 9 | protected LQIEvent(LanguageQualityIssue lqi) { 10 | this.lqi = lqi; 11 | } 12 | 13 | public LanguageQualityIssue getLQI() { 14 | return this.lqi; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/no-its-namespace.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | example source 2 8 | example source 2 9 | 10 | 11 |
12 |
13 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ProvenanceSelectionEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.its.model.Provenance; 5 | 6 | public class ProvenanceSelectionEvent extends ItsSelectionEvent implements OcelotEvent { 7 | public ProvenanceSelectionEvent(Provenance prov) { 8 | super(prov); 9 | } 10 | 11 | public Provenance getProvenance() { 12 | return (Provenance)super.getITSMetadata(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/OcelotEditingEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class OcelotEditingEvent implements OcelotEvent { 6 | 7 | public enum Type { 8 | START_EDITING, 9 | STOP_EDITING; 10 | } 11 | 12 | private Type eventType; 13 | 14 | public OcelotEditingEvent(Type eventType) { 15 | this.eventType = eventType; 16 | } 17 | 18 | public Type getEventType(){ 19 | return eventType; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/plugins/TimerPlugin.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.plugins; 2 | 3 | import java.awt.Component; 4 | 5 | public interface TimerPlugin extends Plugin { 6 | 7 | public void startTimer(); 8 | 9 | public double stopTimer(); 10 | 11 | public void resetTimer(); 12 | 13 | public double getSeconds(); 14 | 15 | public double getMinutes(); 16 | 17 | public double getHours(); 18 | 19 | public Component getTimerWidget(); 20 | 21 | public void recordUserActivity(); 22 | 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/LQISelectionEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.its.model.LanguageQualityIssue; 5 | 6 | public class LQISelectionEvent extends ItsSelectionEvent implements OcelotEvent { 7 | public LQISelectionEvent(LanguageQualityIssue lqi) { 8 | super(lqi); 9 | } 10 | 11 | public LanguageQualityIssue getLQI() { 12 | return (LanguageQualityIssue)super.getITSMetadata(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/EnrichingStartedStoppedEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class EnrichingStartedStoppedEvent implements OcelotEvent { 6 | 7 | public static final int STARTED = 0; 8 | 9 | public static final int STOPPED = 1; 10 | 11 | private int action; 12 | 13 | public EnrichingStartedStoppedEvent(int action) { 14 | 15 | this.action = action; 16 | } 17 | 18 | public int getAction(){ 19 | return action; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/SegmentTargetEditEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.segment.model.OcelotSegment; 4 | import com.vistatec.ocelot.segment.model.SegmentVariant; 5 | import com.vistatec.ocelot.xliff.XLIFFDocument; 6 | 7 | public class SegmentTargetEditEvent extends SegmentTargetUpdateEvent { 8 | 9 | public SegmentTargetEditEvent(XLIFFDocument xliff, OcelotSegment segment, SegmentVariant updatedTarget) { 10 | super(xliff, segment, updatedTarget); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ItsDocStatsUpdateLqiEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.its.model.LanguageQualityIssue; 5 | 6 | public class ItsDocStatsUpdateLqiEvent implements OcelotEvent { 7 | private final LanguageQualityIssue lqi; 8 | 9 | public ItsDocStatsUpdateLqiEvent(LanguageQualityIssue lqi) { 10 | this.lqi = lqi; 11 | } 12 | 13 | public LanguageQualityIssue getLqi() { 14 | return this.lqi; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/LQIRemoveEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.its.model.LanguageQualityIssue; 4 | import com.vistatec.ocelot.segment.model.OcelotSegment; 5 | 6 | public class LQIRemoveEvent extends LQIEvent { 7 | private final OcelotSegment segment; 8 | 9 | public LQIRemoveEvent(LanguageQualityIssue lqi, OcelotSegment segment) { 10 | super(lqi); 11 | this.segment = segment; 12 | } 13 | 14 | public OcelotSegment getSegment() { 15 | return this.segment; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/SegmentTargetUpdateFromMatchEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.segment.model.OcelotSegment; 4 | import com.vistatec.ocelot.segment.model.SegmentVariant; 5 | import com.vistatec.ocelot.xliff.XLIFFDocument; 6 | 7 | public class SegmentTargetUpdateFromMatchEvent extends SegmentTargetUpdateEvent { 8 | 9 | public SegmentTargetUpdateFromMatchEvent(XLIFFDocument xliff, OcelotSegment segment, 10 | SegmentVariant updatedTarget) { 11 | super(xliff, segment, updatedTarget); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/api/OcelotEventQueueListener.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events.api; 2 | 3 | /** 4 | * Signifies that the implementing object is expecting to receive 5 | * {@link OcelotEvent}s to its appropriately annotated methods. Note: this only 6 | * ensures that objects that want to listen to events posted on the 7 | * {@link EventQueue} must be an implementation of this interface; this does 8 | * not mean all implementing objects will have methods that are listening for an 9 | * {@link OcelotEvent} 10 | */ 11 | public interface OcelotEventQueueListener {} -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/xliff/XLIFFDocument.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.xliff; 2 | 3 | import java.io.File; 4 | import java.util.List; 5 | 6 | import com.vistatec.ocelot.segment.model.OcelotSegment; 7 | 8 | import net.sf.okapi.common.LocaleId; 9 | 10 | public interface XLIFFDocument { 11 | 12 | public File getFile(); 13 | 14 | public LocaleId getSrcLocale(); 15 | 16 | public LocaleId getTgtLocale(); 17 | 18 | public List getSegments(); 19 | 20 | public XLIFFVersion getVersion(); 21 | 22 | public String getOriginal(); 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/config/ocelot_cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "userProvenance" : { }, 3 | "tmManagement" : { 4 | "fuzzyThreshold" : 0.75, 5 | "maxResults" : 5 6 | }, 7 | "layout" : { 8 | "showTranslations" : true, 9 | "showAttrsView" : true, 10 | "showDetailsView" : true, 11 | "segmentsGrid" : { 12 | "showSegNum" : true, 13 | "showSource" : true, 14 | "showTarget" : true, 15 | "showOriginalTarget" : true, 16 | "showNotes" : false, 17 | "showEditDist" : false, 18 | "showFlags" : [ true, true, true, true, true ] 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ItsDocStatsRecalculateEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import java.util.List; 4 | 5 | import com.vistatec.ocelot.events.api.OcelotEvent; 6 | import com.vistatec.ocelot.segment.model.OcelotSegment; 7 | 8 | public class ItsDocStatsRecalculateEvent implements OcelotEvent { 9 | private final List segments; 10 | 11 | public ItsDocStatsRecalculateEvent(List segments) { 12 | this.segments = segments; 13 | } 14 | 15 | public List getSegments() { 16 | return segments; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ItsDocStatsRemovedLqiEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import java.util.List; 4 | 5 | import com.vistatec.ocelot.events.api.OcelotEvent; 6 | import com.vistatec.ocelot.segment.model.OcelotSegment; 7 | 8 | public class ItsDocStatsRemovedLqiEvent implements OcelotEvent { 9 | private final List segments; 10 | 11 | public ItsDocStatsRemovedLqiEvent(List segments) { 12 | this.segments = segments; 13 | } 14 | 15 | public List getSegments() { 16 | return this.segments; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/plugins/ReportPlugin.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.plugins; 2 | 3 | import java.awt.Window; 4 | import java.util.List; 5 | 6 | import com.vistatec.ocelot.segment.model.OcelotSegment; 7 | 8 | public interface ReportPlugin extends Plugin { 9 | 10 | 11 | public void generateReport(Window window) throws ReportException; 12 | 13 | public void onOpenFile(String fileName, List segments); 14 | 15 | public class ReportException extends Exception { 16 | 17 | private static final long serialVersionUID = 8206326021490700485L; 18 | 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/resources/conf/ocelot_cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "userProvenance" : { }, 3 | "tmManagement" : { 4 | "fuzzyThreshold" : 0.75, 5 | "maxResults" : 5 6 | }, 7 | "layout" : { 8 | "showTranslations" : true, 9 | "showAttrsView" : true, 10 | "showDetailsView" : true, 11 | "showManageConfs" : true, 12 | "segmentsGrid" : { 13 | "showSegNum" : true, 14 | "showSource" : true, 15 | "showTarget" : true, 16 | "showOriginalTarget" : true, 17 | "showNotes" : false, 18 | "showEditDist" : false, 19 | "showFlags" : [ true, true, true, true, true ] 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/plugins/exception/UnknownServiceException.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.plugins.exception; 2 | 3 | /** 4 | * Exception raised when an unknown FREME service is requested. 5 | */ 6 | public class UnknownServiceException extends Exception { 7 | 8 | /** The serial version UID. */ 9 | private static final long serialVersionUID = -2437668083201198756L; 10 | 11 | /** 12 | * Constructor. 13 | * 14 | * @param cause 15 | * the cause. 16 | */ 17 | public UnknownServiceException(Throwable cause) { 18 | 19 | super("Unknown FREME service.", cause); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/SegmentVariantSelectionEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.segment.model.SegmentVariant; 5 | 6 | public class SegmentVariantSelectionEvent implements OcelotEvent { 7 | 8 | private SegmentVariant segmentVariant; 9 | 10 | public SegmentVariantSelectionEvent(SegmentVariant segmentVariant) { 11 | 12 | this.segmentVariant = segmentVariant; 13 | } 14 | 15 | public SegmentVariant getSegmentVariant() { 16 | return segmentVariant; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/xliff/XLIFFWriter.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.xliff; 2 | 3 | import com.vistatec.ocelot.segment.model.OcelotSegment; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.io.UnsupportedEncodingException; 8 | 9 | public interface XLIFFWriter { 10 | public void updateSegment(OcelotSegment seg); 11 | 12 | public void updateNotes(OcelotSegment seg); 13 | 14 | public void updateTiming(Double time); 15 | 16 | public void updateLqiConfiguration(String lqiConfName); 17 | 18 | public void save(File file) throws IOException, UnsupportedEncodingException; 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/spellcheck/Spelling_en.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ghhghhh 7 | This segment has one misspelled word: fud. 8 | 9 | 10 | asdfghjkl; 11 | This segment has two misspelled words: hoge fuga. 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /sample_plugins/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.vistatec.ocelot.plugins.samples 6 | build-sample-plugins 7 | 2.1-SNAPSHOT 8 | pom 9 | 10 | Ocelot Sample Plugins 11 | 12 | 13 | ITSPlugin 14 | SegmentPlugin 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/assembly/deployment.xml: -------------------------------------------------------------------------------- 1 | 5 | osx 6 | 7 | zip 8 | 9 | 10 | 11 | ${project.build.directory} 12 | / 13 | 14 | Ocelot.app/** 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/profile/ProfileException.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.profile; 2 | 3 | 4 | /** 5 | * Exception raised when an error occurs while managing profiles. 6 | */ 7 | public class ProfileException extends Exception { 8 | 9 | /** 10 | * 11 | */ 12 | private static final long serialVersionUID = -4026647559526874454L; 13 | 14 | public ProfileException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public ProfileException(Throwable cause) { 19 | super(cause); 20 | } 21 | 22 | public ProfileException(String message) { 23 | super(message); 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/testconfig/ocelot_cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.vistatec.ocelot.plugins.samples.itsplugin.SampleITSPlugin 5 | false 6 | 7 | 8 | com.vistatec.ocelot.plugins.samples.segmentplugin.SampleSegmentPlugin 9 | true 10 | 11 | 12 | A 13 | B 14 | C 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/OpenFileEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.xliff.XLIFFDocument; 5 | 6 | public class OpenFileEvent implements OcelotEvent { 7 | private final String filename; 8 | private XLIFFDocument xliff; 9 | 10 | public OpenFileEvent(String filename, XLIFFDocument xliff) { 11 | this.filename = filename; 12 | this.xliff = xliff; 13 | } 14 | 15 | public String getFilename() { 16 | return filename; 17 | } 18 | 19 | public XLIFFDocument getDocument() { 20 | return xliff; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger = WARN, stderr, log_file 2 | 3 | log4j.appender.stderr = org.apache.log4j.ConsoleAppender 4 | log4j.appender.stderr.Target = System.err 5 | log4j.appender.stderr.layout = org.apache.log4j.SimpleLayout 6 | 7 | log4j.appender.log_file = org.apache.log4j.RollingFileAppender 8 | log4j.appender.log_file.File = ocelot.log 9 | log4j.appender.log_file.layout = org.apache.log4j.EnhancedPatternLayout 10 | log4j.appender.log_file.layout.ConversionPattern = [%d{yyyy-MM-dd HH:mm:ss Z}] %p %c{1.}: %m%n 11 | log4j.appender.log_file.MaxFileSize = 10MB 12 | log4j.appender.log_file.MaxBackupIndex = 30 13 | 14 | log4j.logger.com.vistatec = DEBUG 15 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/api/OcelotEventQueue.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events.api; 2 | 3 | /** 4 | * A thin wrapper of the Guava {@link com.google.common.eventbus.EventBus} 5 | * to allow for mock test event queues. May want to consider a stronger 6 | * abstraction in case the implementation is changed (relies on 7 | * {@link com.google.common.eventbus.Subscribe} annotations for the listeners). 8 | */ 9 | public interface OcelotEventQueue { 10 | 11 | public void post(OcelotEvent event); 12 | 13 | public void registerListener(OcelotEventQueueListener listener); 14 | 15 | public void unregisterListener(OcelotEventQueueListener listener); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/lqi/gui/LQIGridColumn.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.lqi.gui; 2 | 3 | /** 4 | * Column used in the LQI grid. 5 | */ 6 | public class LQIGridColumn { 7 | 8 | /** The column name. */ 9 | private String name; 10 | 11 | 12 | /** 13 | * Constructor. 14 | * @param name the column name. 15 | */ 16 | public LQIGridColumn(String name) { 17 | this.name = name; 18 | } 19 | 20 | /** 21 | * Gets the column name. 22 | * @return the column name. 23 | */ 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | /** 29 | * Sets the column name. 30 | * @param name the column name. 31 | */ 32 | public void setName(String name) { 33 | this.name = name; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/com/vistatec/ocelot/xliff/okapi/TestOkapiXLIFFFactory.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.xliff.okapi; 2 | 3 | import java.io.File; 4 | 5 | import org.junit.Test; 6 | import static org.junit.Assert.*; 7 | 8 | import com.vistatec.ocelot.xliff.XLIFFFactory; 9 | import com.vistatec.ocelot.xliff.XLIFFVersion; 10 | 11 | public class TestOkapiXLIFFFactory { 12 | 13 | @Test 14 | public void testDontBeFooledByItsVersionAttribute() throws Exception { 15 | File testFile = new File(getClass().getResource("/empty_xliff_12_with_itsVersion.xlf").toURI()); 16 | XLIFFFactory factory = new OkapiXLIFFFactory(); 17 | assertEquals(XLIFFVersion.XLIFF12, factory.detectXLIFFVersion(testFile)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/xliff/XLIFFFactory.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.xliff; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import javax.xml.stream.XMLStreamException; 7 | 8 | import com.vistatec.ocelot.config.UserProvenance; 9 | import com.vistatec.ocelot.events.api.OcelotEventQueue; 10 | 11 | public interface XLIFFFactory { 12 | 13 | public XLIFFVersion detectXLIFFVersion(File detectVersion) throws IOException, XMLStreamException; 14 | 15 | public XLIFFParser newXLIFFParser(XLIFFVersion xliffVersion) throws IOException, XMLStreamException; 16 | 17 | public XLIFFWriter newXLIFFWriter(XLIFFParser parser, 18 | UserProvenance userProvenance, OcelotEventQueue eventQueue); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/SegmentTargetUpdateEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.segment.model.OcelotSegment; 4 | import com.vistatec.ocelot.segment.model.SegmentVariant; 5 | import com.vistatec.ocelot.xliff.XLIFFDocument; 6 | 7 | public class SegmentTargetUpdateEvent extends SegmentEvent { 8 | 9 | private final SegmentVariant updatedTarget; 10 | 11 | 12 | public SegmentTargetUpdateEvent(XLIFFDocument xliff, OcelotSegment segment, SegmentVariant updatedTarget) { 13 | super(xliff, segment); 14 | this.updatedTarget = updatedTarget; 15 | } 16 | 17 | public SegmentVariant getUpdatedTarget() { 18 | return this.updatedTarget; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/SegmentEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.segment.model.OcelotSegment; 5 | import com.vistatec.ocelot.xliff.XLIFFDocument; 6 | 7 | public abstract class SegmentEvent implements OcelotEvent { 8 | private OcelotSegment segment; 9 | private XLIFFDocument xliff; 10 | 11 | protected SegmentEvent(XLIFFDocument xliff, OcelotSegment segment) { 12 | this.xliff = xliff; 13 | this.segment = segment; 14 | } 15 | 16 | public XLIFFDocument getDocument() { 17 | return xliff; 18 | } 19 | 20 | public OcelotSegment getSegment() { 21 | return segment; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/SegmentNoteUpdatedEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.segment.model.OcelotSegment; 4 | import com.vistatec.ocelot.xliff.XLIFFDocument; 5 | 6 | public class SegmentNoteUpdatedEvent extends SegmentEvent{ 7 | 8 | // private final Note note; 9 | 10 | private final String noteContent; 11 | 12 | public SegmentNoteUpdatedEvent(XLIFFDocument xliff, OcelotSegment segment, String noteContent) { 13 | super(xliff, segment); 14 | // this.note = note; 15 | this.noteContent = noteContent; 16 | } 17 | // 18 | // public Note getNote(){ 19 | // return note; 20 | // 21 | // } 22 | 23 | public String getNoteContent(){ 24 | return noteContent; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/freme/gui/LDGraphFrame.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.freme.gui; 2 | 3 | import java.awt.Component; 4 | import java.awt.Window; 5 | 6 | import javax.swing.JDialog; 7 | 8 | public class LDGraphFrame extends JDialog { 9 | 10 | private static final long serialVersionUID = 8754322433455263070L; 11 | 12 | public LDGraphFrame(Window owner, Component graphComponent, int segNum, 13 | boolean isTarget) { 14 | 15 | super(owner); 16 | setTitle("Linked Data Graph - Segment #" + segNum + " - " 17 | + (isTarget ? "target" : "source")); 18 | add(graphComponent); 19 | pack(); 20 | setLocationRelativeTo(owner); 21 | 22 | } 23 | 24 | public void open() { 25 | 26 | setVisible(true); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/com/vistatec/ocelot/rules/RulesTestHelpers.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.rules; 2 | 3 | import com.vistatec.ocelot.its.model.LanguageQualityIssue; 4 | 5 | public class RulesTestHelpers { 6 | 7 | public static LanguageQualityIssue lqi(String type, int severity) { 8 | LanguageQualityIssue lqi = new LanguageQualityIssue(); 9 | lqi.setType(type); 10 | lqi.setSeverity(severity); 11 | return lqi; 12 | } 13 | public static LanguageQualityIssue lqi(String type, int severity, String comment) { 14 | LanguageQualityIssue lqi = new LanguageQualityIssue(); 15 | lqi.setType(type); 16 | lqi.setSeverity(severity); 17 | lqi.setComment(comment); 18 | return lqi; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/storage/model/PostUploadRequest.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.storage.model; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | /** 8 | * @author KatiaI 9 | * 10 | */ 11 | public class PostUploadRequest implements Serializable { 12 | 13 | /** 14 | * 15 | */ 16 | private static final long serialVersionUID = 1L; 17 | 18 | @JsonProperty("fileId") 19 | private String fileId; 20 | 21 | public String getFileId() { 22 | return fileId; 23 | } 24 | 25 | public void setFileId(String fileId) { 26 | this.fileId = fileId; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return "PostUploadRequest [fileId=" + fileId + "]"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/segment/model/okapi/OkapiCodeAtom.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.segment.model.okapi; 2 | 3 | import com.vistatec.ocelot.segment.model.CodeAtom; 4 | 5 | import net.sf.okapi.common.resource.Code; 6 | 7 | /** 8 | * Extend the regular CodeAtom to carry the original Okapi-specific data 9 | * structure for copy-and-paste purposes. 10 | * 11 | * TODO: This seems like it might be a poor solution. Think harder. 12 | */ 13 | public class OkapiCodeAtom extends CodeAtom { 14 | 15 | private final Code code; 16 | 17 | public OkapiCodeAtom(String id, String data, String verboseData, Code code) { 18 | super(id, data, verboseData); 19 | this.code = code; 20 | } 21 | 22 | public Code getCode() { 23 | return code; 24 | } 25 | } -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/plugins/exception/AuditProfileException.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.plugins.exception; 2 | 3 | public class AuditProfileException extends Exception { 4 | 5 | private static final long serialVersionUID = -6708221333787474964L; 6 | 7 | public AuditProfileException() { 8 | // TODO Auto-generated constructor stub 9 | } 10 | 11 | public AuditProfileException(String message, Throwable cause) { 12 | super(message, cause); 13 | // TODO Auto-generated constructor stub 14 | } 15 | 16 | public AuditProfileException(String message) { 17 | super(message); 18 | // TODO Auto-generated constructor stub 19 | } 20 | 21 | public AuditProfileException(Throwable cause) { 22 | super(cause); 23 | // TODO Auto-generated constructor stub 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/tm/gui/DetachableComponent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.tm.gui; 2 | 3 | import java.awt.Component; 4 | import java.awt.Window; 5 | 6 | /** 7 | * This interface provide methods for managing detachable Swing components. A 8 | * class defining a Swing component that can be detached by the owner window and 9 | * can be displayed inside its own window, should implement this interface. 10 | */ 11 | public interface DetachableComponent { 12 | 13 | /** 14 | * Gets the attached Component. 15 | * 16 | * @return the component. 17 | */ 18 | public Component getAttachedComponent(); 19 | 20 | /** 21 | * Gets a window displaying only the component. 22 | * 23 | * @return a window displaying the component. 24 | */ 25 | public Window getDetachedComponent(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/json/ProfileConfig.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config.json; 2 | 3 | 4 | public class ProfileConfig implements RootConfig { 5 | 6 | public final static String DEFAULT_PROF_NAME = "Default"; 7 | 8 | private String profile; 9 | 10 | private boolean promptMessage; 11 | 12 | public void setProfile(String profile){ 13 | this.profile = profile; 14 | } 15 | 16 | public String getProfile(){ 17 | return profile; 18 | } 19 | 20 | public void setPromptMessage(boolean promptMessage ){ 21 | this.promptMessage = promptMessage; 22 | } 23 | 24 | public boolean getPromptMessage(){ 25 | return promptMessage; 26 | } 27 | 28 | public void setDefaultProfile(){ 29 | profile = DEFAULT_PROF_NAME; 30 | promptMessage = true; 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/spellcheck/CheckResult.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.spellcheck; 2 | 3 | import java.util.List; 4 | 5 | import com.vistatec.ocelot.findrep.FindResult; 6 | 7 | public class CheckResult extends FindResult { 8 | 9 | private String word; 10 | private List suggestions; 11 | 12 | public CheckResult(int segmentIndex, int atomIndex, int stringStartIndex, int stringEndIndex, String word, 13 | List suggestions) { 14 | super(segmentIndex, atomIndex, stringStartIndex, stringEndIndex, true); 15 | this.word = word; 16 | this.suggestions = suggestions; 17 | } 18 | 19 | public String getWord() { 20 | return word; 21 | } 22 | 23 | public List getSuggestions() { 24 | return suggestions; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/config/lqi_config_plain.json: -------------------------------------------------------------------------------- 1 | { 2 | "activeConfName": "Test", 3 | "lqiConfigurations": [ 4 | { 5 | "name": "Test", 6 | "threshold": 80.0, 7 | "supplier": "Google", 8 | "severities": [ 9 | 10 | { 11 | "name": "Minor", 12 | "score": 1.0 13 | }, 14 | { 15 | "name": "Major", 16 | "score": 2.0 17 | }, 18 | { 19 | "name": "Critical", 20 | "score": 4.0 21 | } 22 | 23 | ], 24 | "errorCategories": [ 25 | 26 | { 27 | "name": "terminology", 28 | "position": 1, 29 | "weight": 20.0, 30 | "shortcuts": [ 31 | { 32 | "severity": "Minor", 33 | "keyCode": 127, 34 | "modifiers": "" 35 | } 36 | 37 | ] 38 | 39 | } 40 | 41 | ] 42 | } 43 | 44 | ] 45 | } -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/spellcheck/Spelling_ru.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ghhghhh 7 | Перево́д — деятелллльность по интерпретации смысла текста на одном языке (исходном языке [ИЯ]) и созданию нового эквивалентного ему текста на другом языке (переводящем языке [ПЯ]). 8 | 9 | 10 | asdfghjkl; 11 | Переводческая деятельность подразделяется на два существенно отличающихся друг от друга типа перевода. 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ProvenanceAddEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.its.model.Provenance; 5 | import com.vistatec.ocelot.segment.model.OcelotSegment; 6 | 7 | public class ProvenanceAddEvent implements OcelotEvent { 8 | private final Provenance prov; 9 | private final OcelotSegment seg; 10 | public final boolean isOcelotProv; 11 | 12 | public ProvenanceAddEvent(Provenance prov, OcelotSegment seg, boolean isOcelotProv) { 13 | this.prov = prov; 14 | this.seg = seg; 15 | this.isOcelotProv = isOcelotProv; 16 | } 17 | 18 | public Provenance getProvenance() { 19 | return prov; 20 | } 21 | 22 | public OcelotSegment getSegment() { 23 | return seg; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/services/XliffService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.services; 2 | 3 | import com.vistatec.ocelot.xliff.XLIFFDocument; 4 | 5 | import java.io.File; 6 | import java.io.FileNotFoundException; 7 | import java.io.IOException; 8 | import javax.xml.stream.XMLStreamException; 9 | 10 | import com.vistatec.ocelot.events.api.OcelotEventQueueListener; 11 | 12 | /** 13 | * Service for performing XLIFF related operations. 14 | */ 15 | public interface XliffService extends OcelotEventQueueListener { 16 | 17 | public XLIFFDocument parse(File xliffFile) throws IOException, XMLStreamException; 18 | 19 | public void save(XLIFFDocument xliffFile, File dest) throws FileNotFoundException, IOException; 20 | 21 | public void saveTime(Double time); 22 | 23 | public void saveLqiConfiguration(String lqiConfigurationName); 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/tm/okapi/export_tagged_tmx_test_goal.tmx: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | <mrk id="1" type="its:its" translate="no"test<mrk id="2" type="its:its" translate="no" 5 | <mrk id="1" type="its:its" translate="no"test<mrk id="2" type="its:its" translate="no" 6 | 7 | 8 |
9 | -------------------------------------------------------------------------------- /src/test/resources/test.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Hello 8 | Hello 9 | 10 | 11 | goodbye etc . 12 | goodbye etc . 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/SegmentEditEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.segment.model.OcelotSegment; 4 | import com.vistatec.ocelot.xliff.XLIFFDocument; 5 | 6 | /** 7 | * Signals that a segment has been edited by the user. 8 | */ 9 | public class SegmentEditEvent extends SegmentEvent { 10 | 11 | public static final int TARGET_CHANGED = 1; 12 | 13 | public static final int TARGET_RESET = 2; 14 | 15 | public static final int LQI_ADDED = 3; 16 | 17 | public static final int LQI_EDITED = 4; 18 | 19 | public static final int LQI_DELETED = 5; 20 | 21 | private int editType; 22 | 23 | public SegmentEditEvent(XLIFFDocument xliff, OcelotSegment segment, int editType) { 24 | super(xliff, segment); 25 | this.editType = editType; 26 | } 27 | 28 | public int getEditType() { 29 | return editType; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/tm/gui/constants/TmIconsConst.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.tm.gui.constants; 2 | 3 | /** 4 | * This interface contains constants defining the icons used in TM components. 5 | */ 6 | public interface TmIconsConst { 7 | 8 | /** The arrow up image. */ 9 | String ARROW_UP_ICO = "arrow-up.png"; 10 | 11 | /** The arrow down image. */ 12 | String ARROW_DOWN_ICO = "arrow-down.png"; 13 | 14 | /** The delete icon image. */ 15 | String DELETE_ICO = "delete.png"; 16 | 17 | /** The change directory icon. */ 18 | String CHANGE_DIR_ICO = "change-dir.png"; 19 | 20 | /** The Settings icon. */ 21 | String SETTINGS_ICO = "settings.png"; 22 | 23 | /** The add icon. */ 24 | String ADD_ICO = "add.png"; 25 | 26 | /** The find icon. */ 27 | String FIND_ICO = "find.png"; 28 | 29 | /** The pin ico. */ 30 | String PIN_ICO = "pin.png"; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/com/vistatec/ocelot/TestXliffFileFilter.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot; 2 | 3 | import java.io.File; 4 | import java.io.FilenameFilter; 5 | 6 | import org.junit.Test; 7 | 8 | import static org.junit.Assert.*; 9 | 10 | public class TestXliffFileFilter { 11 | 12 | @Test 13 | public void test() { 14 | FilenameFilter filter = new XliffFileFilter(); 15 | File dir = new File("foo"); 16 | assertTrue(filter.accept(dir, "test.xlf")); 17 | assertTrue(filter.accept(dir, "test.XLF")); 18 | assertTrue(filter.accept(dir, "test.xliff")); 19 | assertTrue(filter.accept(dir, "test.XLIFF")); 20 | assertFalse(filter.accept(dir, "test.xl")); 21 | assertFalse(filter.accept(dir, "test.xlif")); 22 | assertFalse(filter.accept(dir, "test.xml")); 23 | assertFalse(filter.accept(dir, "test")); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/LQIAdditionEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.its.model.LanguageQualityIssue; 4 | import com.vistatec.ocelot.segment.model.OcelotSegment; 5 | 6 | public class LQIAdditionEvent extends LQIEvent { 7 | private final OcelotSegment segment; 8 | private final boolean quiet; 9 | 10 | public LQIAdditionEvent(LanguageQualityIssue lqi, OcelotSegment segment) { 11 | this(lqi, segment, false); 12 | } 13 | 14 | public LQIAdditionEvent(LanguageQualityIssue lqi, OcelotSegment segment, boolean quiet) { 15 | super(lqi); 16 | this.segment = segment; 17 | this.quiet = quiet; 18 | } 19 | 20 | public OcelotSegment getSegment() { 21 | return this.segment; 22 | } 23 | 24 | public boolean isQuiet() { 25 | return this.quiet; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/UserProfileSaveEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.config.UserProvenance; 4 | import com.vistatec.ocelot.events.api.OcelotEvent; 5 | 6 | public class UserProfileSaveEvent implements OcelotEvent { 7 | private final UserProvenance profile; 8 | 9 | public UserProfileSaveEvent(UserProvenance profile) { 10 | this.profile = profile; 11 | } 12 | 13 | public UserProvenance getProfile() { 14 | return this.profile; 15 | } 16 | 17 | public class Success implements OcelotEvent {} 18 | public class Failure implements OcelotEvent { 19 | public final String failureMsg; 20 | public final Exception ex; 21 | 22 | public Failure(String failureMsg, Exception ex) { 23 | this.failureMsg = failureMsg; 24 | this.ex = ex; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/lqi/gui/ConfigurationItem.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.lqi.gui; 2 | 3 | import com.vistatec.ocelot.lqi.model.LQIGridConfiguration; 4 | 5 | public class ConfigurationItem { 6 | 7 | private LQIGridConfiguration configuration; 8 | 9 | public ConfigurationItem(LQIGridConfiguration configuration) { 10 | 11 | this.configuration = configuration; 12 | } 13 | 14 | public LQIGridConfiguration getConfiguration() { 15 | return configuration; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return configuration.getName(); 21 | } 22 | 23 | @Override 24 | public boolean equals(Object obj) { 25 | if(obj != null && obj instanceof ConfigurationItem){ 26 | ConfigurationItem confItem = (ConfigurationItem) obj; 27 | return configuration.equals(confItem.getConfiguration()); 28 | } else { 29 | return super.equals(obj); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/segment/model/okapi/Note.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.segment.model.okapi; 2 | 3 | public class Note { 4 | 5 | public static final String OCELOT_ID_PREFIX = "ocelot-"; 6 | 7 | public static final String OCELOT_FROM_PROPERTY = "ocelot"; 8 | 9 | private String id; 10 | 11 | private String content; 12 | 13 | public Note() { 14 | } 15 | 16 | public Note(String id, String content) { 17 | 18 | this.id = id; 19 | this.content = content; 20 | } 21 | 22 | public String getId() { 23 | return id; 24 | } 25 | 26 | public void setId(String id) { 27 | this.id = id; 28 | } 29 | 30 | public String getContent() { 31 | return content; 32 | } 33 | 34 | public void setContent(String content) { 35 | this.content = content; 36 | } 37 | 38 | public boolean isOcelotNote(){ 39 | return id != null && id.startsWith(OCELOT_ID_PREFIX); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/test/java/com/vistatec/ocelot/storage/service/util/UtilTest.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.storage.service.util; 2 | 3 | import static org.junit.Assert.*; 4 | 5 | import org.junit.Before; 6 | import org.junit.Test; 7 | 8 | import com.vistatec.ocelot.storage.model.PostUploadRequest; 9 | 10 | public class UtilTest { 11 | 12 | private String fileId; 13 | 14 | @Before 15 | public void setUp(){ 16 | fileId = "test-fileId"; 17 | } 18 | 19 | @Test 20 | public void testGetPostUploadRequest() { 21 | PostUploadRequest postUploadRequest = Util.getPostUploadRequest(fileId); 22 | assertEquals(fileId,postUploadRequest.getFileId()); 23 | } 24 | 25 | @Test 26 | public void testSerializeToJson() { 27 | PostUploadRequest request = new PostUploadRequest(); 28 | request.setFileId(fileId); 29 | String serializedToJson = Util.serializeToJson(request); 30 | assertTrue(serializedToJson.contains(fileId)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/api/EventBusWrapper.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events.api; 2 | 3 | import com.google.common.eventbus.EventBus; 4 | import com.google.inject.Inject; 5 | 6 | /** 7 | * Wraps a Guava {@link com.google.common.eventbus.EventBus}. 8 | */ 9 | public class EventBusWrapper implements OcelotEventQueue { 10 | private final EventBus eventBus; 11 | 12 | @Inject 13 | public EventBusWrapper(EventBus eventBus) { 14 | this.eventBus = eventBus; 15 | } 16 | 17 | @Override 18 | public void post(OcelotEvent event) { 19 | this.eventBus.post(event); 20 | } 21 | 22 | @Override 23 | public void registerListener(OcelotEventQueueListener listener) { 24 | this.eventBus.register(listener); 25 | } 26 | 27 | @Override 28 | public void unregisterListener(OcelotEventQueueListener listener) { 29 | this.eventBus.unregister(listener); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/PlatformSupport.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot; 2 | 3 | import java.awt.event.KeyEvent; 4 | 5 | import javax.swing.JMenu; 6 | import javax.swing.KeyStroke; 7 | 8 | public interface PlatformSupport { 9 | /** 10 | * Perform platform-specific initialization. 11 | */ 12 | void init(Ocelot ocelot); 13 | 14 | /** 15 | * Return the platform key mask for menu shortcuts. 16 | */ 17 | int getPlatformKeyMask(); 18 | 19 | /** 20 | * Return true if the platform key is down. 21 | */ 22 | boolean isPlatformKeyDown(KeyEvent ke); 23 | 24 | /** 25 | * Set menu mnemonics. Mnemonics violate the Apple HIG, so 26 | * this is a no-op for OSX. 27 | */ 28 | void setMenuMnemonics(JMenu file, JMenu view, JMenu extensions, JMenu help); 29 | 30 | /** 31 | * Get the set of reserved keys for this platform. 32 | */ 33 | KeyStroke[] getReservedKeys(); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/LQIConfigurationSelectionChangedEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.lqi.model.LQIGridConfiguration; 5 | 6 | public class LQIConfigurationSelectionChangedEvent implements OcelotEvent { 7 | 8 | private LQIGridConfiguration newSelectedConfiguration; 9 | 10 | private LQIGridConfiguration oldSelectedConfiguration; 11 | 12 | public LQIConfigurationSelectionChangedEvent(LQIGridConfiguration newSelectedConfiguration, LQIGridConfiguration oldSelectedConfiguration) { 13 | 14 | this.newSelectedConfiguration = newSelectedConfiguration; 15 | this.oldSelectedConfiguration = oldSelectedConfiguration; 16 | } 17 | 18 | public LQIGridConfiguration getNewSelectedConfiguration() { 19 | return newSelectedConfiguration; 20 | } 21 | 22 | public LQIGridConfiguration getOldSelectedConfiguration(){ 23 | return oldSelectedConfiguration; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/HighlightEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.vistatec.ocelot.events.api.OcelotEvent; 7 | import com.vistatec.ocelot.findrep.FindResult; 8 | 9 | public class HighlightEvent implements OcelotEvent { 10 | 11 | private List highlightDataList; 12 | 13 | private int currResultIndex; 14 | 15 | public HighlightEvent(List highlightDataList, int currResultIndex) { 16 | 17 | this.highlightDataList = highlightDataList; 18 | this.currResultIndex = currResultIndex; 19 | } 20 | 21 | public HighlightEvent(FindResult highlightData) { 22 | 23 | highlightDataList = new ArrayList(); 24 | highlightDataList.add(highlightData); 25 | 26 | } 27 | 28 | public List getHighlightDataList(){ 29 | return highlightDataList; 30 | } 31 | 32 | public int getCurrResultIndex(){ 33 | 34 | return currResultIndex; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/tm/okapi/export_multiple_segments_tmx_test_goal.tmx: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | source 1 5 | target 1 6 | 7 | 8 | <mrk id="1" type="its:its" translate="no"test<mrk id="2" type="its:its" translate="no" 9 | <mrk id="1" type="its:its" translate="no"test<mrk id="2" type="its:its" translate="no" 10 | 11 | 12 |
13 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/lgk/IHttpRequestService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.lgk; 2 | 3 | import java.io.IOException; 4 | import java.util.Map; 5 | 6 | import org.apache.http.HttpResponse; 7 | 8 | public interface IHttpRequestService { 9 | 10 | /** 11 | * This method executes an HTTP GET request. 12 | * 13 | * @param url 14 | * the request URL. 15 | * @param headerParams 16 | * a map defining the header parameters. 17 | * @return an HTTP response. 18 | * @throws IOException 19 | */ 20 | public HttpResponse executeGetRequest(String url, 21 | Map headerParams) throws IOException; 22 | 23 | /** 24 | * Check if the response is a successful one by checking if the status code 25 | * is HTTP 200. 26 | * 27 | * @param response 28 | * the response to check 29 | * @return true if the status code is 200; false 30 | * otherwise. 31 | */ 32 | public boolean isSuccessful(HttpResponse response); 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/LQIEditEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.its.model.LanguageQualityIssue; 4 | import com.vistatec.ocelot.segment.model.OcelotSegment; 5 | 6 | public class LQIEditEvent extends LQIEvent { 7 | private final OcelotSegment segment; 8 | private final LanguageQualityIssue segmentLQI; 9 | private final LanguageQualityIssue oldLQI; 10 | 11 | public LQIEditEvent(LanguageQualityIssue editedLQI, LanguageQualityIssue oldLQI, OcelotSegment segment, 12 | LanguageQualityIssue segmentLQI) { 13 | super(editedLQI); 14 | this.segment = segment; 15 | this.segmentLQI = segmentLQI; 16 | this.oldLQI = oldLQI; 17 | } 18 | 19 | public OcelotSegment getSegment() { 20 | return this.segment; 21 | } 22 | 23 | public LanguageQualityIssue getSegmentLQI() { 24 | return segmentLQI; 25 | } 26 | 27 | public LanguageQualityIssue getOldLQI(){ 28 | return oldLQI; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/UserProvenance.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | import com.vistatec.ocelot.its.model.Provenance; 4 | 5 | public class UserProvenance extends Provenance { 6 | 7 | private String langCode; 8 | 9 | public UserProvenance(String revPerson, String revOrg, String extRef) { 10 | this(revPerson, revOrg, extRef, null); 11 | } 12 | 13 | public UserProvenance(String revPerson, String revOrg, String extRef, String langCode) { 14 | setRevPerson(revPerson); 15 | setRevOrg(revOrg); 16 | setProvRef(extRef); 17 | this.langCode = langCode; 18 | } 19 | 20 | public boolean isEmpty() { 21 | return !(getRevPerson() != null || 22 | getRevOrg() != null|| 23 | getProvRef() != null || langCode != null); 24 | } 25 | 26 | public void setLangCode(String langCode){ 27 | 28 | this.langCode = langCode; 29 | } 30 | 31 | public String getLangCode(){ 32 | return langCode; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/xliff/okapi/test_file_xliff1.2.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | This is a short test sentence. 5 | This is a short sentence. 6 | 7 | 8 | And another test sentence. 9 | And another test sentence. 10 | 11 | 12 | And a third test sentence. 13 | And a third test sentence. 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/LQIConfigurationsChangedEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.lqi.model.LQIGridConfigurations; 5 | import com.vistatec.ocelot.lqi.model.LQIGridConfiguration; 6 | 7 | public class LQIConfigurationsChangedEvent implements OcelotEvent { 8 | 9 | private LQIGridConfigurations lqiGridSavedConfigurations; 10 | 11 | private LQIGridConfiguration oldActiveConf; 12 | 13 | public LQIConfigurationsChangedEvent(LQIGridConfigurations lqiGridSavedConfigurations, 14 | LQIGridConfiguration oldActiveConf) { 15 | 16 | this.lqiGridSavedConfigurations = lqiGridSavedConfigurations; 17 | this.oldActiveConf = oldActiveConf; 18 | } 19 | 20 | public LQIGridConfigurations getLqiGridSavedConfigurations() { 21 | return lqiGridSavedConfigurations; 22 | } 23 | 24 | public boolean isActiveConfChanged() { 25 | return oldActiveConf != null; 26 | } 27 | 28 | public LQIGridConfiguration getOldActiveConfiguration(){ 29 | return oldActiveConf; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/LQIModificationEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.its.model.LanguageQualityIssue; 5 | import com.vistatec.ocelot.segment.model.OcelotSegment; 6 | 7 | public class LQIModificationEvent implements OcelotEvent { 8 | private final LanguageQualityIssue lqi; 9 | private final OcelotSegment segment; 10 | private final boolean quiet; 11 | 12 | public LQIModificationEvent(LanguageQualityIssue lqi, OcelotSegment segment) { 13 | this(lqi, segment, false); 14 | } 15 | 16 | public LQIModificationEvent(LanguageQualityIssue lqi, OcelotSegment segment, boolean quiet) { 17 | this.lqi = lqi; 18 | this.segment = segment; 19 | this.quiet = quiet; 20 | } 21 | 22 | public OcelotSegment getSegment() { 23 | return segment; 24 | } 25 | 26 | public LanguageQualityIssue getLQI() { 27 | return lqi; 28 | } 29 | 30 | public boolean isQuiet() { 31 | return quiet; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/EnrichmentViewEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | import com.vistatec.ocelot.segment.model.BaseSegmentVariant; 5 | 6 | public class EnrichmentViewEvent implements OcelotEvent { 7 | 8 | public static final int STD_VIEW = 0; 9 | 10 | public static final int GRAPH_VIEW = 1; 11 | 12 | private BaseSegmentVariant variant; 13 | 14 | private int segNum; 15 | 16 | private int viewType; 17 | 18 | private boolean target; 19 | 20 | public EnrichmentViewEvent(final BaseSegmentVariant variant, final int segNum, final int viewType, final boolean target) { 21 | 22 | this.variant = variant; 23 | this.viewType = viewType; 24 | this.target = target; 25 | this.segNum = segNum; 26 | } 27 | 28 | public BaseSegmentVariant getVariant(){ 29 | return variant; 30 | } 31 | 32 | public int getViewType() { 33 | return viewType; 34 | } 35 | 36 | public int getSegNum(){ 37 | return segNum; 38 | } 39 | 40 | public boolean isTarget() { 41 | return target; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/tm/penalty/PenalizedTmMatch.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.tm.penalty; 2 | 3 | import com.vistatec.ocelot.segment.model.SegmentVariant; 4 | import com.vistatec.ocelot.tm.TmMatch; 5 | 6 | /** 7 | * Wrapper around a {@link TmMatch} that both applies and keeps track of the penalty applied. 8 | */ 9 | public class PenalizedTmMatch implements TmMatch { 10 | private final TmMatch match; 11 | private final float penalty; 12 | 13 | public PenalizedTmMatch(TmMatch match, float penalty) { 14 | this.match = match; 15 | this.penalty = penalty; 16 | } 17 | 18 | @Override 19 | public String getTmOrigin() { 20 | return this.match.getTmOrigin(); 21 | } 22 | 23 | @Override 24 | public float getMatchScore() { 25 | return this.match.getMatchScore() - penalty; 26 | } 27 | 28 | @Override 29 | public SegmentVariant getSource() { 30 | return this.match.getSource(); 31 | } 32 | 33 | @Override 34 | public SegmentVariant getTarget() { 35 | return this.match.getTarget(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/xliff/okapi/test_file_with_note_deleted_xliff1.2.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | This is a short test sentence. 6 | This is a short sentence. 7 | 8 | 9 | And another test sentence. 10 | And another test sentence. 11 | 12 | 13 | And a third test sentence. 14 | And a third test sentence. 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/its/model/EnrichmentMetaData.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.its.model; 2 | 3 | /** 4 | * Meta data representing the enrichments from FREME. 5 | */ 6 | public abstract class EnrichmentMetaData extends ITSMetadata { 7 | 8 | /** Segment constant. */ 9 | public static final String SEGMENT = "Segment"; 10 | 11 | /** Source constant. */ 12 | public static final String SOURCE = "Source"; 13 | 14 | /** The target constant. */ 15 | public static final String TARGET = "Target"; 16 | 17 | /** The part of the segment containing this meta data. */ 18 | private String segPart; 19 | 20 | /** 21 | * Gets the part of the segment containing the meta data. 22 | * 23 | * @return the part of the segment containing the meta data. 24 | */ 25 | public String getSegPart() { 26 | return segPart; 27 | } 28 | 29 | /** 30 | * Sets the part of the segment containing the meta data. 31 | * 32 | * @param segPart 33 | * the part of the segment containing the meta data. 34 | */ 35 | public void setSegPart(String segPart) { 36 | this.segPart = segPart; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/resources/conf/rules.properties: -------------------------------------------------------------------------------- 1 | Critical_non-conformance.locQualityIssueType = non-conformance 2 | Critical_non-conformance.locQualityIssueSeverity = 90-100 3 | Critical_non-conformance.flag.text = * 4 | Critical_non-conformance.flag.fill = #ff0000 5 | Critical_non-conformance.flag.border = #ff0000 6 | Significant_non-conformance.locQualityIssueType = non-conformance 7 | Significant_non-conformance.locQualityIssueSeverity = 80-90 8 | Significant_non-conformance.flag.text = * 9 | Significant_non-conformance.flag.fill = #ff9500 10 | Significant_non-conformance.flag.border = #ff9500 11 | Important_non-conformance.locQualityIssueType = non-conformance 12 | Important_non-conformance.locQualityIssueSeverity = 70-80 13 | Important_non-conformance.flag.text = * 14 | Important_non-conformance.flag.fill = #ffff00 15 | Important_non-conformance.flag.border = #ffff00 16 | Possible_non-conformance.locQualityIssueType = non-conformance 17 | Possible_non-conformance.locQualityIssueSeverity = 60-70 18 | Possible_non-conformance.flag.text = * 19 | Possible_non-conformance.flag.fill = #ff56e1 20 | Possible_non-conformance.flag.border = #ff56e1 -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/xliff/okapi/test_file_with_note_xliff1.2.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | This is a short test sentence. 6 | This is a short sentence. 7 | Note 1 8 | 9 | And another test sentence. 10 | And another test sentence. 11 | 12 | 13 | And a third test sentence. 14 | And a third test sentence. 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/json/PluginConfig.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config.json; 2 | 3 | import com.vistatec.ocelot.plugins.Plugin; 4 | 5 | 6 | public class PluginConfig { 7 | 8 | private String className; 9 | 10 | private boolean enabled; 11 | 12 | public PluginConfig() { 13 | 14 | } 15 | 16 | public PluginConfig(Plugin plugin, boolean enabled ) { 17 | 18 | if(plugin != null){ 19 | this.className = plugin.getClass().getName(); 20 | } 21 | this.enabled = enabled; 22 | } 23 | 24 | public void setClassName(String className) { 25 | this.className = className; 26 | } 27 | 28 | public String getClassName() { 29 | return className; 30 | } 31 | 32 | public void setEnabled(boolean enabled) { 33 | this.enabled = enabled; 34 | } 35 | 36 | public boolean isEnabled() { 37 | return enabled; 38 | } 39 | 40 | public boolean matches(Plugin plugin ){ 41 | 42 | return className.equals(plugin.getClass().getName()); 43 | } 44 | 45 | public String toString() { 46 | 47 | return "class name: " + className + ", enabled: " + enabled; 48 | 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/test/resources/gold/lqi_no_provenance.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Hello 8 | Hello 9 | 10 | 11 | goodbye etc . 12 | goodbye etc . 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/xliff/okapi/test_file_with_note_updated_xliff1.2.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | This is a short test sentence. 6 | This is a short sentence. 7 | Note 1 updated 8 | 9 | And another test sentence. 10 | And another test sentence. 11 | 12 | 13 | And a third test sentence. 14 | And a third test sentence. 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/xliff/okapi/test_file_multiple_seg_2.0.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Sentence 1. Sentence 2. 7 | 8 | 9 | 10 | 11 | 12 | 13 | Sentence 3 (no-trans). Sentence 4 (no-trans). 14 | 15 | 16 | 17 | 18 | 19 | 20 | Sentence 5. 21 | 22 | 23 | 24 | 25 | 26 | 27 | Sentence 6 (no-trans). 28 | 29 | 30 | 31 | 32 | 33 | 34 | Sentence 7. Sentence 8. 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/test/resources/gold/no-its-namespace.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | example source 2 8 | example source 2 9 | 10 | 11 |
12 | 13 | 14 | 15 |
16 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/segment/model/PositionAtom.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.segment.model; 2 | 3 | import java.util.List; 4 | 5 | import com.vistatec.ocelot.segment.view.SegmentTextCell; 6 | 7 | public class PositionAtom implements SegmentAtom { 8 | 9 | private final BaseSegmentVariant bsv; 10 | 11 | public PositionAtom(BaseSegmentVariant bsv) { 12 | this.bsv = bsv; 13 | } 14 | 15 | public int getPosition() { 16 | List atoms = bsv.getAtoms(); 17 | int pos = 0; 18 | for (SegmentAtom atom : atoms) { 19 | if (atom == this) { 20 | return pos; 21 | } else { 22 | pos += atom.getLength(); 23 | } 24 | } 25 | throw new IllegalStateException("This PositionAtom is no longer associated with its parent SegmentVariant."); 26 | } 27 | 28 | @Override 29 | public int getLength() { 30 | return 0; 31 | } 32 | 33 | @Override 34 | public String getData() { 35 | return ""; 36 | } 37 | 38 | @Override 39 | public String getTextStyle() { 40 | return SegmentTextCell.regularStyle; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/events/ReplaceEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.events; 2 | 3 | import com.vistatec.ocelot.events.api.OcelotEvent; 4 | 5 | public class ReplaceEvent implements OcelotEvent { 6 | 7 | public static final int REPLACE = 0; 8 | 9 | public static final int REPLACE_ALL = 1; 10 | 11 | private String oldString; 12 | private String newString; 13 | 14 | private int action; 15 | 16 | private int segmentIndex; 17 | 18 | public ReplaceEvent(String oldString, String newString, int action) { 19 | this.oldString = oldString; 20 | this.newString = newString; 21 | this.action = action; 22 | } 23 | 24 | public ReplaceEvent(String oldString, String newString, int segmentIndex, int action) { 25 | this.oldString = oldString; 26 | this.newString = newString; 27 | this.segmentIndex = segmentIndex; 28 | this.action = action; 29 | } 30 | 31 | public String getOldString() { 32 | return oldString; 33 | } 34 | 35 | public String getNewString() { 36 | return newString; 37 | } 38 | 39 | 40 | public int getSegmentIndex(){ 41 | return segmentIndex; 42 | } 43 | 44 | public int getAction(){ 45 | return action; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/ui/TooltipCellRenderer.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.ui; 2 | 3 | import java.awt.Component; 4 | 5 | import javax.swing.JLabel; 6 | import javax.swing.JTable; 7 | import javax.swing.table.DefaultTableCellRenderer; 8 | 9 | /** 10 | * This table cell renderer displays assigns a tooltip text to the renderer component. 11 | * The tooltip textt is the text assigned to the component itself. 12 | */ 13 | public class TooltipCellRenderer extends DefaultTableCellRenderer{ 14 | 15 | /** The serial version UID. */ 16 | private static final long serialVersionUID = -7079489996462488540L; 17 | 18 | /* 19 | * (non-Javadoc) 20 | * @see javax.swing.table.DefaultTableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int) 21 | */ 22 | @Override 23 | public Component getTableCellRendererComponent(JTable table, Object value, 24 | boolean isSelected, boolean hasFocus, int row, int column) { 25 | JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, 26 | row, column); 27 | if(value != null){ 28 | label.setToolTipText(value.toString()); 29 | } 30 | return label; 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/xliff20/noTargets.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Sentence 1. Sentence 2. 7 | 8 | 9 | 10 | 11 | 12 | Sentence 3 (no-trans). Sentence 4 (no-trans). 13 | 14 | 15 | 16 | 17 | 18 | Sentence 5. 19 | 20 | 21 | 22 | 23 | 24 | Sentence 6 (no-trans). 25 | 26 | 27 | 28 | 29 | 30 | Sentence 7. Sentence 8. 31 | 32 | 33 | Sentence with A. Sentence with . 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/rules/DataCategoryFlagRenderer.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.rules; 2 | 3 | import java.awt.Component; 4 | 5 | import javax.swing.JLabel; 6 | import javax.swing.JTable; 7 | import javax.swing.UIManager; 8 | import javax.swing.table.TableCellRenderer; 9 | 10 | /** 11 | * Render {@link DataCategoryFlag} data (fill, border, glyph) in a table cell. 12 | */ 13 | public class DataCategoryFlagRenderer extends JLabel implements TableCellRenderer { 14 | private static final long serialVersionUID = 1L; 15 | 16 | public DataCategoryFlagRenderer() { 17 | setOpaque(true); 18 | } 19 | 20 | @Override 21 | public Component getTableCellRendererComponent(JTable jtable, Object obj, boolean isSelected, boolean hasFocus, int row, int col) { 22 | DataCategoryFlag flag = (DataCategoryFlag)obj; 23 | if (flag != null) { 24 | setBackground(flag.getFill()); 25 | setBorder(hasFocus ? 26 | UIManager.getBorder("Table.focusCellHighlightBorder") : 27 | flag.getBorder()); 28 | setText(flag.getText()); 29 | } 30 | setHorizontalAlignment(CENTER); 31 | return this; 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/test/java/com/vistatec/ocelot/TestOcelotApp.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertFalse; 5 | import static org.junit.Assert.assertTrue; 6 | 7 | import java.io.File; 8 | import java.io.IOException; 9 | import java.net.URISyntaxException; 10 | 11 | import javax.xml.stream.XMLStreamException; 12 | 13 | public class TestOcelotApp { 14 | private OcelotApp ocelotApp; 15 | 16 | public void before() { 17 | } 18 | 19 | public void testDefaultFlags() { 20 | assertFalse(ocelotApp.isFileDirty()); 21 | assertFalse(ocelotApp.hasOpenFile()); 22 | } 23 | 24 | public void testOpenSimpleXliff() throws IOException, URISyntaxException, XMLStreamException { 25 | ocelotApp.openFile(loadResource("/test.xlf"), false); 26 | assertEquals("en", ocelotApp.getFileSourceLang()); 27 | assertEquals("fr", ocelotApp.getFileTargetLang()); 28 | assertTrue(ocelotApp.hasOpenFile()); 29 | assertFalse(ocelotApp.isFileDirty()); 30 | } 31 | 32 | private File loadResource(String resource) throws URISyntaxException { 33 | return new File(getClass().getResource(resource).toURI()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/json/OcelotAzureConfig.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config.json; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | 5 | public class OcelotAzureConfig { 6 | 7 | private String blobEndpoint; 8 | 9 | private String queueEndpoint; 10 | 11 | private String sas; 12 | 13 | public String getBlobEndpoint(){ 14 | return blobEndpoint; 15 | } 16 | 17 | public void setBlobEndpoint( String blobEndpoint){ 18 | 19 | this.blobEndpoint = blobEndpoint; 20 | } 21 | 22 | public String getQueueEndpoint(){ 23 | return queueEndpoint; 24 | } 25 | 26 | public void setQueueEndpoint(String queueEndpoint){ 27 | this.queueEndpoint = queueEndpoint; 28 | } 29 | 30 | public String getSas(){ 31 | return sas; 32 | } 33 | 34 | public void setSas(String sas){ 35 | this.sas = sas; 36 | } 37 | 38 | /** 39 | * Checks if the configuration is completely defined. 40 | * 41 | * @return true if all configuration parameters are defined; 42 | * false if at least one parameter is missing. 43 | */ 44 | @JsonIgnore 45 | public boolean isComplete(){ 46 | 47 | return sas != null && blobEndpoint != null && queueEndpoint != null; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/segment/model/okapi/OffsetTaggedCodeAtom.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.segment.model.okapi; 2 | 3 | import net.sf.okapi.lib.xliff2.core.Tag; 4 | 5 | /** 6 | * This class tracks the Okapi tag the code atom was created for. In addition, 7 | * it stores info about the offset in the text fragment where the tag should be 8 | * inserted. 9 | */ 10 | public class OffsetTaggedCodeAtom extends TaggedCodeAtom { 11 | 12 | /** The offset in the text where the tag has to been inserted. */ 13 | private int offset; 14 | 15 | /** 16 | * Constructor. 17 | * 18 | * @param tag 19 | * the tag 20 | * @param data 21 | * the tag data 22 | * @param verboseData 23 | * the tag attributes 24 | * @param offset 25 | * the tag offset 26 | */ 27 | public OffsetTaggedCodeAtom(Tag tag, String data, String verboseData, 28 | int offset) { 29 | super(tag, data, verboseData); 30 | this.offset = offset; 31 | } 32 | 33 | /** 34 | * Gets the tag offset. 35 | * 36 | * @return the tag offset. 37 | */ 38 | public int getOffset() { 39 | return offset; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/gold/multiple-its-namespace.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | example source 2 8 | example source 2 9 | 10 | 11 |
12 | 13 | 14 | 15 |
16 | -------------------------------------------------------------------------------- /src/main/resources/conf/lqi_cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "activeConfName" : "Default Configuration", 3 | "lqiConfigurations" : [ { 4 | "name" : "Default Configuration", 5 | "threshold" : 0.0, 6 | "errorCategories" : [ { 7 | "name" : "terminology", 8 | "position" : 1, 9 | "weight" : 0.0 10 | }, { 11 | "name" : "style", 12 | "position" : 2, 13 | "weight" : 0.0 14 | }, { 15 | "name" : "inconsistent-entities", 16 | "position" : 3, 17 | "weight" : 0.0 18 | }, { 19 | "name" : "duplication", 20 | "position" : 4, 21 | "weight" : 0.0 22 | }, { 23 | "name" : "internationalization", 24 | "position" : 5, 25 | "weight" : 0.0 26 | }, { 27 | "name" : "whitespace", 28 | "position" : 6, 29 | "weight" : 0.0 30 | }, { 31 | "name" : "omission", 32 | "position" : 7, 33 | "weight" : 0.0 34 | }, { 35 | "name" : "mistranslation", 36 | "position" : 8, 37 | "weight" : 0.0 38 | } ], 39 | "severities" : [ { 40 | "name" : "Minor", 41 | "score" : 1.0 42 | }, { 43 | "name" : "Major", 44 | "score" : 2.0 45 | }, { 46 | "name" : "Critical", 47 | "score" : 4.0 48 | } ] 49 | } ] 50 | } -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/tm/okapi/simple_tm.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 |
10 | 11 | 12 | 13 | 14 | apple orange pear 15 | 16 | 17 | manzana narajna pera 18 | 19 | 20 | 21 | 22 | 23 | orange apple pear 24 | 25 | 26 | narajna manzana pera 27 | 28 | 29 | 30 | 31 | 32 | banana apple 33 | 34 | 35 | plátano manzana 36 | 37 | 38 | 39 | 40 | 41 | watermelon pineapple 42 | 43 | 44 | sandía piña 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/tm/penalty/SimpleTmPenalizer.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.tm.penalty; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.google.inject.Inject; 7 | import com.vistatec.ocelot.config.json.TmManagement.TmConfig; 8 | import com.vistatec.ocelot.tm.TmManager; 9 | import com.vistatec.ocelot.tm.TmMatch; 10 | import com.vistatec.ocelot.tm.TmPenalizer; 11 | 12 | /** 13 | * Applies the penalty specified in the {@link TmManagement.TmConfig} for each 14 | * match based on their TM origin if applicable. 15 | */ 16 | public class SimpleTmPenalizer implements TmPenalizer { 17 | private final TmManager tmManager; 18 | 19 | @Inject 20 | public SimpleTmPenalizer(TmManager tmManager) { 21 | this.tmManager = tmManager; 22 | } 23 | 24 | @Override 25 | public List applyPenalties(List matches) { 26 | List penalizedMatches = new ArrayList<>(); 27 | for (TmMatch match : matches) { 28 | TmConfig config = tmManager.fetchTm(match.getTmOrigin()); 29 | penalizedMatches.add(new PenalizedTmMatch(match, 30 | config == null ? 0 : config.getPenalty())); 31 | } 32 | return penalizedMatches; 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/plugins/exception/FremeEnrichmentException.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.plugins.exception; 2 | 3 | /** 4 | * Exception raised when an error occurs while enriching text with FREME 5 | * services. 6 | */ 7 | public class FremeEnrichmentException extends Exception { 8 | 9 | /** The serial version UID. */ 10 | private static final long serialVersionUID = 4405345546068794641L; 11 | 12 | /** 13 | * Constructor. 14 | * 15 | * @param cause 16 | * the cause. 17 | */ 18 | public FremeEnrichmentException(Throwable cause) { 19 | super("Error while enriching a NIF content.", cause); 20 | } 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param textToEnrich 26 | * the text to enrich 27 | * @param cause 28 | * the cause 29 | */ 30 | public FremeEnrichmentException(String textToEnrich, Throwable cause) { 31 | super(buildMessage(textToEnrich), cause); 32 | } 33 | 34 | /** 35 | * Builds the error message. 36 | * 37 | * @param textToEnrich 38 | * the text to enrich 39 | * @return the error message. 40 | */ 41 | private static String buildMessage(final String textToEnrich) { 42 | 43 | return "Error while enriching following text: " + textToEnrich; 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/ui/ODialogPanel.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.ui; 2 | 3 | import java.awt.LayoutManager; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | 7 | import javax.swing.JButton; 8 | import javax.swing.JDialog; 9 | import javax.swing.JPanel; 10 | 11 | /** 12 | * Base class for panels that implement modeless dialogs. 13 | */ 14 | public abstract class ODialogPanel extends JPanel { 15 | private static final long serialVersionUID = 1L; 16 | private JDialog parent; 17 | 18 | public ODialogPanel(LayoutManager mgr) { 19 | super(mgr); 20 | } 21 | 22 | public JButton getDefaultButton() { 23 | return null; 24 | } 25 | 26 | protected JDialog getDialog() { 27 | return parent; 28 | } 29 | 30 | public void setDialog(JDialog dialog) { 31 | this.parent = dialog; 32 | parent.add(this); 33 | } 34 | 35 | public void postInit() { 36 | } 37 | 38 | /** 39 | * Action listener that cleans up the containing dialog. 40 | */ 41 | public class DisposeDialogListener implements ActionListener { 42 | @Override 43 | public void actionPerformed(ActionEvent e) { 44 | getDialog().dispose(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/com/vistatec/ocelot/config/TestOcelotJsonConfigTransferService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.io.Writer; 6 | 7 | import com.vistatec.ocelot.config.json.OcelotRootConfig; 8 | import com.vistatec.ocelot.config.json.RootConfig; 9 | 10 | public class TestOcelotJsonConfigTransferService extends JsonConfigTransferService { 11 | 12 | private Writer writer; 13 | 14 | public TestOcelotJsonConfigTransferService(File confFile, Writer writer) { 15 | super(confFile); 16 | this.writer = writer; 17 | } 18 | 19 | @Override 20 | public RootConfig read() throws TransferException { 21 | OcelotRootConfig config = null; 22 | try { 23 | config = mapper.readValue(confFile, OcelotRootConfig.class); 24 | } catch (IOException e) { 25 | throw new TransferException(e); 26 | } 27 | return config; 28 | } 29 | 30 | @Override 31 | public void save(RootConfig config) throws TransferException { 32 | 33 | LOG.debug("Saving the configuration of Ocelot..."); 34 | try { 35 | mapper.writeValue(writer, config); 36 | } catch (IOException e) { 37 | throw new TransferException(e); 38 | } 39 | } 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/xliff/okapi/XLIFF2.0_example.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Sentence 1. Sentence 2. 7 | 8 | 9 | 10 | 11 | 12 | 13 | Sentence 3 (no-trans). Sentence 4 (no-trans). 14 | 15 | 16 | 17 | 18 | 19 | 20 | Sentence 5. 21 | 22 | 23 | 24 | 25 | 26 | 27 | Sentence 6 (no-trans). 28 | 29 | 30 | 31 | 32 | 33 | 34 | Sentence 7. Sentence 8. 35 | 36 | 37 | 38 | Sentence with A. Sentence with . 39 | Sentence with A. Sentence with . 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/test/java/com/vistatec/ocelot/config/TestProfileConfigTransferService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.io.Writer; 6 | 7 | import com.vistatec.ocelot.config.json.OcelotRootConfig; 8 | import com.vistatec.ocelot.config.json.ProfileConfig; 9 | import com.vistatec.ocelot.config.json.RootConfig; 10 | 11 | public class TestProfileConfigTransferService extends JsonConfigTransferService { 12 | 13 | private Writer writer; 14 | 15 | public TestProfileConfigTransferService(File confFile, Writer writer) { 16 | super(confFile); 17 | this.writer = writer; 18 | } 19 | 20 | @Override 21 | public RootConfig read() throws TransferException { 22 | 23 | ProfileConfig config = null; 24 | try { 25 | config = mapper.readValue(confFile, ProfileConfig.class); 26 | } catch (IOException e) { 27 | throw new TransferException(e); 28 | } 29 | return config; 30 | } 31 | 32 | @Override 33 | public void save(RootConfig config) throws TransferException { 34 | LOG.debug("Saving the profile configuration..."); 35 | try { 36 | mapper.writeValue(writer, config); 37 | } catch (IOException e) { 38 | throw new TransferException(e); 39 | } 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/xliff/okapi/xliff1.2.not-enriched-small.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 19 miles (31 kilometers) to the northeast of Wicklow, is Bray, a popular spot for visitors wishing to discover more of the region. 6 | 19 miles (31 kilometers) to the northeast of Wicklow, is Bray, a popular spot for visitors wishing to discover more of the region. 7 | 8 | 9 | A single line of text containing both <<placeholder>> and <h2>paired</h2> tags. 10 | A single line of text containing both <<placeholder>> and <h2>paired</h2> tags. 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/ProfileConfigTransferService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import com.vistatec.ocelot.config.json.ProfileConfig; 7 | import com.vistatec.ocelot.config.json.RootConfig; 8 | 9 | public class ProfileConfigTransferService extends JsonConfigTransferService { 10 | 11 | public ProfileConfigTransferService(File confFile) { 12 | super(confFile); 13 | } 14 | 15 | @Override 16 | public RootConfig read() throws TransferException { 17 | 18 | LOG.debug("Reading the Profile configuration..."); 19 | ProfileConfig config = null; 20 | try { 21 | config = mapper.readValue(confFile, ProfileConfig.class); 22 | } catch (IOException e) { 23 | LOG.error("Error while reading the Profile configuration file", e); 24 | throw new TransferException(e); 25 | } 26 | return config; 27 | } 28 | 29 | @Override 30 | public void save(RootConfig config) throws TransferException { 31 | LOG.debug("Saving the Profile configuration..."); 32 | try { 33 | mapper.writeValue(confFile, config); 34 | } catch (IOException e) { 35 | LOG.error("Error while writing the Profile configuration file.", e); 36 | throw new TransferException(e); 37 | } 38 | 39 | } 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/xliff/freme/EnrichmentAnnotationsConstants.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.xliff.freme; 2 | 3 | public interface EnrichmentAnnotationsConstants { 4 | 5 | /** Prefix used for FREME marker IDs. */ 6 | public String MARKER_FREME_ID_PREFIX = "freme-"; 7 | 8 | /** The marker tag name. */ 9 | public String MARKER_TAG_NAME = "mrk"; 10 | 11 | /** The id attribute for the marker tag. */ 12 | public String MARKER_TAG_ID_ATTR = "id"; 13 | 14 | /** The JSON marker name. */ 15 | public String JSON_TAG_NAME = "ex:json-ld"; 16 | 17 | /** The JSON marker prefix. */ 18 | public String JSON_TAG_PREFIX = "ex"; 19 | 20 | /** The JSON marker local name. */ 21 | public String JSON_TAG_LOCAL_NAME = "json-ld"; 22 | 23 | /** JSON tag domain. */ 24 | public String JSON_TAG_DOMAIN = "http://example.com"; 25 | 26 | /** JSON tag domain attribute name. */ 27 | public String JSON_TAG_DOMAIN_ATTR = "xmlns:ex"; 28 | 29 | /** JSON tag segment attribute name. */ 30 | public String JSON_TAG_SEG_ATTR = "segment"; 31 | 32 | /** JSON-LD format constant. */ 33 | public String JSON_LD_FORMAT = "JSON-LD"; 34 | 35 | /** Text-Analysis annotators ref start string. */ 36 | public String TA_ANNOTATORS_REF_STRING = "text-analysis|"; 37 | 38 | /** Terminology annotators ref start string. */ 39 | public String TERM_ANNOTATORS_REF_STRING = "terminology|"; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/TextContextMenu.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot; 2 | 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | 6 | import javax.swing.JMenuItem; 7 | import javax.swing.JPopupMenu; 8 | 9 | import com.vistatec.ocelot.events.ConcordanceSearchEvent; 10 | import com.vistatec.ocelot.events.api.OcelotEventQueue; 11 | 12 | public class TextContextMenu extends JPopupMenu implements ActionListener { 13 | 14 | /** 15 | * 16 | */ 17 | private static final long serialVersionUID = -255396661863113048L; 18 | 19 | private JMenuItem mnuConcordance; 20 | 21 | private OcelotEventQueue eventQueue; 22 | 23 | private String selectedText; 24 | 25 | public TextContextMenu(final OcelotEventQueue eventQueue, final String selectedText, final boolean target) { 26 | 27 | this.eventQueue = eventQueue; 28 | this.selectedText = selectedText; 29 | buildMenu(target); 30 | } 31 | 32 | private void buildMenu(boolean target){ 33 | 34 | if(!target){ 35 | mnuConcordance = new JMenuItem("Concordance Search"); 36 | mnuConcordance.addActionListener(this); 37 | add(mnuConcordance); 38 | } 39 | 40 | } 41 | 42 | @Override 43 | public void actionPerformed(ActionEvent e) { 44 | 45 | if(e.getSource().equals(mnuConcordance)){ 46 | eventQueue.post(new ConcordanceSearchEvent(selectedText)); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/json/ProvenanceConfig.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config.json; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonRootName; 5 | 6 | @JsonRootName(value="userProvenance") 7 | public class ProvenanceConfig { 8 | 9 | @JsonProperty("externalReference") 10 | private String extRef; 11 | 12 | @JsonProperty("revOrganization") 13 | private String revOrg; 14 | 15 | private String revPerson; 16 | 17 | private String langCode; 18 | 19 | public void setExtRef(String extRef ){ 20 | this.extRef = extRef; 21 | } 22 | 23 | public String getExtRef(){ 24 | return extRef; 25 | } 26 | 27 | public void setRevOrg(String revOrg) { 28 | this.revOrg = revOrg; 29 | } 30 | 31 | public String getRevOrg(){ 32 | return revOrg; 33 | } 34 | 35 | public void setRevPerson(String revPerson){ 36 | this.revPerson = revPerson; 37 | } 38 | 39 | public String getRevPerson(){ 40 | return revPerson; 41 | } 42 | 43 | public void setLangCode(String langCode){ 44 | this.langCode = langCode; 45 | } 46 | 47 | public String getLangCode(){ 48 | return langCode; 49 | } 50 | 51 | @Override 52 | public String toString() { 53 | 54 | return "Reviewer: " + revPerson + ", organization: " + revOrg 55 | + ", external ref: " + extRef + ", language code: " + langCode; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/LqiJsonConfigTransferService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import com.vistatec.ocelot.config.json.LQIGridRootConfig; 7 | import com.vistatec.ocelot.config.json.RootConfig; 8 | 9 | public class LqiJsonConfigTransferService extends JsonConfigTransferService { 10 | 11 | public LqiJsonConfigTransferService(File confFile) { 12 | super(confFile); 13 | } 14 | 15 | @Override 16 | public RootConfig read() throws TransferException { 17 | LOG.debug("Reading the main configuration of LQI grid..."); 18 | LQIGridRootConfig config = null; 19 | try { 20 | config = mapper.readValue(confFile, LQIGridRootConfig.class); 21 | } catch (IOException e) { 22 | LOG.error("Error while reading the configuration file of LQI grid", e); 23 | throw new TransferException(e); 24 | } 25 | return config; 26 | } 27 | 28 | @Override 29 | public void save(RootConfig config) throws TransferException { 30 | LOG.debug("Saving the configuration of LQI grid..."); 31 | try { 32 | mapper.writeValue(confFile, config); 33 | } catch (IOException e) { 34 | LOG.error("Error while writing the configuration file of LQI grid", e); 35 | throw new TransferException(e); 36 | } 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/OcelotJsonConfigTransferService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import com.vistatec.ocelot.config.json.OcelotRootConfig; 7 | import com.vistatec.ocelot.config.json.RootConfig; 8 | 9 | public class OcelotJsonConfigTransferService extends JsonConfigTransferService { 10 | 11 | public OcelotJsonConfigTransferService(File confFile) { 12 | super(confFile); 13 | } 14 | 15 | @Override 16 | public RootConfig read() throws TransferException { 17 | 18 | LOG.debug("Reading the main configuration of Ocelot..."); 19 | OcelotRootConfig config = null; 20 | try { 21 | config = mapper.readValue(confFile, OcelotRootConfig.class); 22 | } catch (IOException e) { 23 | LOG.error("Error while reading the configuration file of Ocelot", e); 24 | throw new TransferException(e); 25 | } 26 | return config; 27 | } 28 | 29 | @Override 30 | public void save(RootConfig config) throws TransferException { 31 | 32 | LOG.debug("Saving the configuration of Ocelot..."); 33 | try { 34 | mapper.writeValue(confFile, config); 35 | } catch (IOException e) { 36 | LOG.error("Error while writing the configuration file of Ocelot", e); 37 | throw new TransferException(e); 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/lgk/HttpRequestService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.lgk; 2 | 3 | import java.io.IOException; 4 | import java.util.Map; 5 | import java.util.Map.Entry; 6 | 7 | import org.apache.http.HttpResponse; 8 | import org.apache.http.HttpStatus; 9 | import org.apache.http.client.HttpClient; 10 | import org.apache.http.client.methods.HttpGet; 11 | import org.apache.http.impl.client.DefaultHttpClient; 12 | 13 | /** 14 | * This class provides methods for sending HTTP request. 15 | */ 16 | public class HttpRequestService implements IHttpRequestService { 17 | 18 | @Override 19 | public HttpResponse executeGetRequest(String url, 20 | Map headerParams) throws IOException { 21 | 22 | HttpClient client = new DefaultHttpClient(); 23 | HttpGet request = new HttpGet(url); 24 | setHeader(request, headerParams); 25 | HttpResponse response = client.execute(request); 26 | return response; 27 | } 28 | 29 | private void setHeader(HttpGet request, Map headerParams) { 30 | 31 | if (headerParams != null) { 32 | for (Entry headerParam : headerParams.entrySet()) { 33 | request.addHeader(headerParam.getKey(), headerParam.getValue()); 34 | } 35 | } 36 | } 37 | 38 | @Override 39 | public boolean isSuccessful(HttpResponse response) { 40 | return response.getStatusLine().getStatusCode() == HttpStatus.SC_OK; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/services/SegmentService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.services; 2 | 3 | import com.vistatec.ocelot.segment.model.OcelotSegment; 4 | import com.vistatec.ocelot.xliff.XLIFFDocument; 5 | 6 | import com.vistatec.ocelot.events.LQIAdditionEvent; 7 | import com.vistatec.ocelot.events.LQIEditEvent; 8 | import com.vistatec.ocelot.events.LQIRemoveEvent; 9 | import com.vistatec.ocelot.events.SegmentNoteUpdatedEvent; 10 | import com.vistatec.ocelot.events.SegmentTargetResetEvent; 11 | import com.vistatec.ocelot.events.SegmentTargetUpdateEvent; 12 | import com.vistatec.ocelot.events.api.OcelotEventQueueListener; 13 | 14 | /** 15 | * Service for performing segment related operations. 16 | */ 17 | public interface SegmentService extends OcelotEventQueueListener { 18 | // TODO: Remove requirement for segment model to be table based 19 | public OcelotSegment getSegment(int row); 20 | 21 | public int getNumSegments(); 22 | 23 | public void setSegments(XLIFFDocument xliff); 24 | 25 | public void updateSegmentTarget(SegmentTargetUpdateEvent e); 26 | public void updateSegmentNote(SegmentNoteUpdatedEvent e); 27 | public void resetSegmentTarget(SegmentTargetResetEvent e); 28 | 29 | public void addLQI(LQIAdditionEvent e); 30 | public void editLQI(LQIEditEvent e); 31 | public void removeLQI(LQIRemoveEvent e); 32 | 33 | public void clearAllSegments(); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/segment/model/okapi/Notes.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.segment.model.okapi; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | 6 | public class Notes extends ArrayList { 7 | 8 | /** 9 | * 10 | */ 11 | private static final long serialVersionUID = -8694657386087109957L; 12 | 13 | public Note getOcelotNote() { 14 | 15 | Note ocelotNote = null; 16 | Iterator noteIt = iterator(); 17 | Note currNote = null; 18 | while (noteIt.hasNext() && ocelotNote == null) { 19 | currNote = noteIt.next(); 20 | if (currNote.isOcelotNote()) { 21 | ocelotNote = currNote; 22 | } 23 | } 24 | return ocelotNote; 25 | } 26 | 27 | // public void addNote(String content, String idSuffix){ 28 | // 29 | // add(new Note(Note.OCELOT_ID_PREFIX + idSuffix, content)); 30 | // } 31 | 32 | public boolean editNote(String content, String idSuffix) { 33 | 34 | boolean edited = false; 35 | Note note = getOcelotNote(); 36 | if(content != null && !content.isEmpty()){ 37 | if(note != null ){ 38 | if( !note.getContent().equals(content)){ 39 | note.setContent(content); 40 | edited = true; 41 | } 42 | } else { 43 | add(new Note(Note.OCELOT_ID_PREFIX + idSuffix, content)); 44 | edited = true; 45 | } 46 | } else if( note != null){ 47 | remove(note); 48 | edited = true; 49 | } 50 | return edited; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/xliff/okapi/file_with_notes_multiple_segm_2.0.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | This is a note for the segment s1 7 | This is a note for the segment s3 8 | 9 | 10 | Sentence 1. Sentence 2. 11 | 12 | 13 | 14 | 15 | 16 | 17 | Sentence 3 (no-trans). Sentence 4 (no-trans). 18 | 19 | 20 | 21 | 22 | 23 | 24 | Sentence 5. 25 | 26 | 27 | 28 | 29 | 30 | 31 | Sentence 6 (no-trans). 32 | 33 | 34 | 35 | 36 | 37 | 38 | Sentence 7. Sentence 8. 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/findrep/Tiny.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | This segment has 22 words that we do not want to translate but would like To show up in the metrics somewhere. Tomato. 7 | ghhghhh 8 | 9 | This segment has 22 words that we do not want to translate but would like to show up in the metrics somewhere. 10 | 11 | 12 | 22 words 13 | 14 | 15 | This segment has a different number of words (26) to segment one and we want these to show up as a different category in the metrics. 16 | This segment has a different number of words (26) to segment one and we want these to show up as a different category in the metrics. 17 | 26 words 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/xliff/okapi/file_with_notes_multiple_segm_updated_2.0.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | This is a note for the segment s1 edited 7 | This is a note for the segment s3 8 | 9 | 10 | Sentence 1. Sentence 2. 11 | 12 | 13 | 14 | 15 | 16 | 17 | Sentence 3 (no-trans). Sentence 4 (no-trans). 18 | 19 | 20 | 21 | 22 | 23 | 24 | Sentence 5. 25 | 26 | 27 | 28 | 29 | 30 | 31 | Sentence 6 (no-trans). 32 | 33 | 34 | 35 | 36 | 37 | 38 | Sentence 7. Sentence 8. 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/services/ProvenanceService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.services; 2 | 3 | import com.google.common.eventbus.Subscribe; 4 | import com.google.inject.Inject; 5 | import com.vistatec.ocelot.config.JsonConfigService; 6 | import com.vistatec.ocelot.config.TransferException; 7 | import com.vistatec.ocelot.events.UserProfileSaveEvent; 8 | import com.vistatec.ocelot.events.api.OcelotEventQueue; 9 | import com.vistatec.ocelot.events.api.OcelotEventQueueListener; 10 | 11 | /** 12 | * Handle provenance related functionality. 13 | */ 14 | public class ProvenanceService implements OcelotEventQueueListener { 15 | private final OcelotEventQueue eventQueue; 16 | private final JsonConfigService cfgService; 17 | 18 | @Inject 19 | public ProvenanceService(OcelotEventQueue eventQueue, JsonConfigService cfgService) { 20 | this.eventQueue = eventQueue; 21 | this.cfgService = cfgService; 22 | } 23 | 24 | @Subscribe 25 | public void saveUserProvenance(UserProfileSaveEvent profileSave) { 26 | try { 27 | cfgService.saveUserProvenance(profileSave.getProfile()); 28 | this.eventQueue.post(profileSave.new Success()); 29 | 30 | } catch (TransferException ex) { 31 | this.eventQueue.post(profileSave.new Failure( 32 | "Failed to save user provenance. Check logs for details", 33 | ex)); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/com/vistatec/ocelot/config/TestProfileConfig.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | import java.io.File; 4 | import java.io.StringWriter; 5 | 6 | import org.junit.Assert; 7 | import org.junit.Test; 8 | 9 | import com.vistatec.ocelot.config.json.ProfileConfig; 10 | 11 | 12 | public class TestProfileConfig { 13 | 14 | @Test 15 | public void testReadProfile() throws TransferException{ 16 | 17 | File confFile = new File(getClass().getResource("def_profile_cfg.json").getFile()); 18 | ProfileConfigService confService = new ProfileConfigService(new ProfileConfigTransferService(confFile)); 19 | Assert.assertTrue(confService.mustPromptMessage()); 20 | Assert.assertEquals(ProfileConfig.DEFAULT_PROF_NAME, confService.getProfileName()); 21 | } 22 | 23 | @Test 24 | public void testWriteProfile() throws TransferException { 25 | 26 | File confFile = new File(getClass().getResource("def_profile_cfg.json").getFile()); 27 | StringWriter writer = new StringWriter(); 28 | ProfileConfigService confService = new ProfileConfigService(new TestProfileConfigTransferService(confFile, writer)); 29 | confService.changeActiveProfile("Test"); 30 | String profString = "\"profile\" : \"Test\""; 31 | Assert.assertTrue(writer.toString().contains(profString)); 32 | confService.doNotShowAgain(); 33 | String msgString = "\"promptMessage\" : false"; 34 | Assert.assertTrue(writer.toString().contains(msgString)); 35 | 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/xliff/okapi/XliffDocumentConstants.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.xliff.okapi; 2 | 3 | public interface XliffDocumentConstants { 4 | 5 | String COUNT_GROUP_START = ""; 6 | 7 | String COUNT_GROUP_END = ""; 8 | 9 | String COUNT_START = ""; 10 | 11 | String COUNT_END = ""; 12 | 13 | String FILE_END = ""; 14 | 15 | String BODY_START = ""; 16 | 17 | String HEADER_START = "
"; 18 | 19 | String HEADER_END = "
"; 20 | 21 | String SKEL_START = ""; 22 | 23 | String SKEL_END = ""; 24 | 25 | String SKEL_PROPERTY_NAME = "skel"; 26 | 27 | String PHASE_START = ""; 28 | 29 | String PHASE_END = ""; 30 | 31 | String PHASE_GROUP_START = ""; 32 | 33 | String PHASE_GROUP_END = ""; 34 | 35 | String PHASE_NAME_ATTR = "phase-name"; 36 | 37 | String PROCESS_NAME_ATTR = "process-name"; 38 | 39 | String CONTACT_NAME_ATTR = "contact-name"; 40 | 41 | String COMPANY_NAME_ATTR = "company-name"; 42 | 43 | String TOOL_START = ""; 44 | 45 | String TOOL_END = ""; 46 | 47 | String TOOL_ID_ATTR = "tool-id"; 48 | 49 | String TOOL_NAME_ATTR = "tool-name"; 50 | 51 | String TOOL_LQI_CONF = "LQI"; 52 | 53 | String SELF_PROP_PLACEHOLDER = "#$$self$@%"; 54 | 55 | String COUNT_GROUP_NAME_ATTR = "name"; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/JsonConfigTransferService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | import java.io.File; 4 | 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | 8 | import com.fasterxml.jackson.annotation.JsonInclude.Include; 9 | import com.fasterxml.jackson.databind.ObjectMapper; 10 | import com.fasterxml.jackson.databind.SerializationFeature; 11 | 12 | public abstract class JsonConfigTransferService implements ConfigTransferService { 13 | 14 | protected static final Logger LOG = LoggerFactory.getLogger(JsonConfigTransferService.class); 15 | 16 | protected ObjectMapper mapper; 17 | 18 | protected File confFile; 19 | 20 | public JsonConfigTransferService(File confFile) { 21 | 22 | mapper = new ObjectMapper(); 23 | mapper.configure(SerializationFeature.INDENT_OUTPUT, true); 24 | // mapper.configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false); 25 | // mapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); 26 | mapper.setSerializationInclusion(Include.NON_NULL ); 27 | mapper.setSerializationInclusion(Include.NON_EMPTY); 28 | // mapper.configure(SerializationFeature.FLUSH_AFTER_WRITE_VALUE, false); 29 | // mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); 30 | // mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); 31 | this.confFile = confFile; 32 | } 33 | 34 | public void setConfFile(File confFile ){ 35 | 36 | this.confFile = confFile; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/test/resources/gold/redundant-its-namespace.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |
6 | 7 | 8 | 9 | Hello 10 | Hello 11 | 12 | 13 | goodbye etc . 14 | goodbye etc . 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 |
-------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/DirectoryBasedConfigs.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileOutputStream; 6 | import java.io.IOException; 7 | import java.io.InputStreamReader; 8 | import java.io.OutputStreamWriter; 9 | import java.io.Reader; 10 | import java.io.Writer; 11 | 12 | public class DirectoryBasedConfigs implements Configs { 13 | 14 | public static final String RULES_CONFIG = "rules.properties"; 15 | 16 | private File dir; 17 | 18 | public DirectoryBasedConfigs(File dir) { 19 | this.dir = dir; 20 | } 21 | 22 | protected Reader getReader(String filename) throws IOException { 23 | File f = new File(dir, filename); 24 | if (!f.exists()) { 25 | return null; 26 | } 27 | return new InputStreamReader(new FileInputStream(f), "UTF-8"); 28 | } 29 | 30 | protected Writer getWriter(String filename) throws IOException { 31 | File f = new File(dir, filename); 32 | if (!f.exists()) { 33 | f.createNewFile(); 34 | } 35 | return new OutputStreamWriter(new FileOutputStream(f), "UTF-8"); 36 | } 37 | 38 | @Override 39 | public Reader getRulesReader() throws IOException { 40 | return getReader(RULES_CONFIG); 41 | } 42 | 43 | @Override 44 | public Writer getRulesWriter() throws IOException { 45 | return getWriter(RULES_CONFIG); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/ProfileConfigService.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import com.vistatec.ocelot.config.json.ProfileConfig; 7 | 8 | public class ProfileConfigService { 9 | 10 | 11 | private final Logger log = LoggerFactory.getLogger(ProfileConfigService.class); 12 | 13 | private final ConfigTransferService cfgXservice; 14 | 15 | private ProfileConfig config; 16 | 17 | public ProfileConfigService(ConfigTransferService cfgXservice) throws TransferException { 18 | 19 | this.cfgXservice = cfgXservice; 20 | config = (ProfileConfig) cfgXservice.read(); 21 | 22 | } 23 | 24 | public String getProfileName(){ 25 | return config.getProfile(); 26 | } 27 | 28 | public boolean mustPromptMessage(){ 29 | return config.getProfile().equalsIgnoreCase(ProfileConfig.DEFAULT_PROF_NAME) && config.getPromptMessage(); 30 | } 31 | 32 | public void changeActiveProfile(String profileName) throws TransferException{ 33 | 34 | log.debug("Changing active profile"); 35 | if(profileName.equals(ProfileConfig.DEFAULT_PROF_NAME)){ 36 | config.setDefaultProfile(); 37 | } else { 38 | config.setProfile(profileName); 39 | } 40 | cfgXservice.save(config); 41 | } 42 | 43 | public void doNotShowAgain() throws TransferException{ 44 | log.debug("Do not show the message again"); 45 | config.setPromptMessage(false); 46 | cfgXservice.save(config); 47 | } 48 | 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/xliff/okapi/xliff2.0.not-enriched-small.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Sentence 1.LQI Sentence 2. 14 | Sentence 1.Prov Sentence 2. 15 | 16 | 17 | Ph element #1. 18 | Ph element #1. 19 | 20 | 21 | Pc element Important #1. 22 | Pc element Important #1. 23 | 24 | 25 | Sm split element #1. 26 | Sm split element #1. 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/ui/TableRowToggleMouseAdapter.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.ui; 2 | 3 | import java.awt.event.MouseAdapter; 4 | import java.awt.event.MouseEvent; 5 | 6 | import javax.swing.JTable; 7 | import javax.swing.table.TableModel; 8 | 9 | /** 10 | * Toggle the (assumed to be boolean) value of a row whenever any column 11 | * in that row is clicked. 12 | */ 13 | public abstract class TableRowToggleMouseAdapter extends MouseAdapter { 14 | 15 | /** 16 | * Implement this method to indicate whether or not a click event to 17 | * the specified row and column should toggle the row value. 18 | * @param row 19 | * @param column 20 | * @return 21 | */ 22 | protected abstract boolean acceptEvent(int row, int column); 23 | 24 | /** 25 | * Specifies the column in the row that contains the value to be 26 | * toggled. The default implementation returns 0. 27 | * @return 28 | */ 29 | protected int getValueColumn() { 30 | return 0; 31 | } 32 | 33 | public void mouseClicked(MouseEvent e) { 34 | JTable target = (JTable)e.getSource(); 35 | int row = target.getSelectedRow(); 36 | int column = target.getSelectedColumn(); 37 | TableModel model = target.getModel(); 38 | if (acceptEvent(row, column)) { 39 | boolean current = (Boolean)model.getValueAt(row, getValueColumn()); 40 | model.setValueAt(!current, row, getValueColumn()); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/lgk/LingoTekServiceException.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.lgk; 2 | 3 | /** 4 | * Exception raised when an error occurs while using LingoTek services. 5 | */ 6 | public class LingoTekServiceException extends Exception { 7 | 8 | private static final long serialVersionUID = -1706861302998369714L; 9 | 10 | /** The error severity. */ 11 | public static final int SEVERITY_ERROR = 1; 12 | 13 | /** The warning severity. */ 14 | public static final int SEVERITY_WARNING = 2; 15 | 16 | /** The severity level for the error that generated the exception. */ 17 | private int severity; 18 | 19 | /** 20 | * Constructor. 21 | * 22 | * @param message 23 | * the exception message 24 | * @param cause 25 | * the cause 26 | * @param severity 27 | * the severity level 28 | */ 29 | public LingoTekServiceException(String message, Throwable cause, 30 | int severity) { 31 | super(message, cause); 32 | this.severity = severity; 33 | } 34 | 35 | /** 36 | * Constructor. 37 | * 38 | * @param message 39 | * the exception message 40 | * @param severity 41 | * the severity level 42 | */ 43 | public LingoTekServiceException(String message, int severity) { 44 | super(message); 45 | this.severity = severity; 46 | } 47 | 48 | /** 49 | * Gets the severity level for this exception. 50 | * 51 | * @return the severity level. 52 | */ 53 | public int getSeverity() { 54 | return severity; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/storage/service/util/Util.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.storage.service.util; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import com.fasterxml.jackson.core.JsonProcessingException; 7 | import com.fasterxml.jackson.databind.ObjectMapper; 8 | import com.vistatec.ocelot.storage.model.PostUploadRequest; 9 | 10 | /** 11 | * @author KatiaI 12 | * 13 | */ 14 | public class Util { 15 | 16 | private static Logger logger = LoggerFactory.getLogger(Util.class); 17 | 18 | /** 19 | * @param fileId the file identifier 20 | * @return the PostUploadRequest object associated to the specified fileId 21 | * that should be sent in Json format to the Storage queue 22 | */ 23 | public static PostUploadRequest getPostUploadRequest(String fileId){ 24 | 25 | PostUploadRequest postUploadRequest = new PostUploadRequest(); 26 | postUploadRequest.setFileId(fileId); 27 | return postUploadRequest; 28 | } 29 | 30 | /** 31 | * @param object the T object to be serialized in Json 32 | * @return the json associated to the object as a json string 33 | */ 34 | public static String serializeToJson(T object){ 35 | 36 | ObjectMapper mapper = new ObjectMapper(); 37 | String serializedResult = null; 38 | try { 39 | serializedResult = mapper.writeValueAsString(object); 40 | } catch (JsonProcessingException e) { 41 | logger.error("Problem encountered while doing json processing."); 42 | } 43 | 44 | return serializedResult; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/com/vistatec/ocelot/tm/okapi/OkapiTmTestHelpers.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.tm.okapi; 2 | 3 | import java.io.File; 4 | import java.net.URISyntaxException; 5 | 6 | import org.jmock.api.Invocation; 7 | import org.jmock.lib.action.CustomAction; 8 | 9 | public class OkapiTmTestHelpers { 10 | 11 | static File getTestOkapiTmDir() throws URISyntaxException { 12 | File packageDir = new File(OkapiTmTestHelpers.class.getResource("").toURI()); 13 | return new File(packageDir, "test"); 14 | } 15 | 16 | static void deleteDirectory(File dir) { 17 | if (dir.exists() && dir.isDirectory()) { 18 | for (File f : dir.listFiles()) { 19 | if (f.isDirectory()) { 20 | deleteDirectory(f); 21 | } else { 22 | f.delete(); 23 | } 24 | } 25 | dir.delete(); 26 | } 27 | } 28 | 29 | /** 30 | * JMock custom action for a mock method that just returns the first 31 | * argument passed to the method. 32 | */ 33 | static class ReturnFirstArgument extends CustomAction { 34 | 35 | public ReturnFirstArgument() { 36 | super("Return First Argument"); 37 | } 38 | 39 | public ReturnFirstArgument(String description) { 40 | super(description); 41 | } 42 | 43 | @Override 44 | public Object invoke(Invocation invocation) throws Throwable { 45 | return invocation.getParameter(0); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/test/resources/oc26.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Source segment. 6 | 7 | Target segment. 8 | 9 | Source segment. 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/lqi/gui/TableCellEvent.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.lqi.gui; 2 | 3 | /** 4 | * This class is an event listened by the {@link TableCellListener}. 5 | */ 6 | public class TableCellEvent { 7 | 8 | /** cell old value. */ 9 | private Object oldValue; 10 | 11 | /** The cell new value. */ 12 | private Object newValue; 13 | 14 | /** The cell row index. */ 15 | private int rowIndex; 16 | 17 | /** The cell column index. */ 18 | private int colIndex; 19 | 20 | 21 | /** 22 | * Constructor. 23 | * @param oldValue the old value 24 | * @param newValue the new value 25 | * @param rowIndex the row index 26 | * @param colIndex the column index 27 | */ 28 | public TableCellEvent(Object oldValue, Object newValue, int rowIndex, 29 | int colIndex) { 30 | this.oldValue = oldValue; 31 | this.newValue = newValue; 32 | this.rowIndex = rowIndex; 33 | this.colIndex = colIndex; 34 | } 35 | 36 | /** 37 | * Gets the old value 38 | * @return the old value 39 | */ 40 | public Object getOldValue() { 41 | return oldValue; 42 | } 43 | 44 | /** 45 | * Gets the new value 46 | * @return the new value 47 | */ 48 | public Object getNewValue() { 49 | return newValue; 50 | } 51 | 52 | /** 53 | * Gets the row index. 54 | * @return the row index. 55 | */ 56 | public int getRowIndex() { 57 | return rowIndex; 58 | } 59 | 60 | /** 61 | * Gets the column index. 62 | * @return the column index. 63 | */ 64 | public int getColIndex() { 65 | return colIndex; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/json/SpellingConfig.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config.json; 2 | 3 | import java.util.HashMap; 4 | import java.util.HashSet; 5 | import java.util.List; 6 | import java.util.Map; 7 | import java.util.Set; 8 | 9 | public class SpellingConfig { 10 | 11 | private Map dictionaries; 12 | 13 | public SpellingConfig() { 14 | this.dictionaries = new HashMap<>(); 15 | } 16 | 17 | public Map getDictionaries() { 18 | return dictionaries; 19 | } 20 | 21 | public void setDictionaries(Map dictionaries) { 22 | this.dictionaries = dictionaries; 23 | } 24 | 25 | public void setDictionary(String language, SpellingDictionary dictionary) { 26 | this.dictionaries.put(language, dictionary); 27 | } 28 | 29 | public SpellingDictionary getDictionary(String language) { 30 | SpellingDictionary dictionary = dictionaries.get(language); 31 | return dictionary == null ? new SpellingDictionary() : dictionary; 32 | } 33 | 34 | public static class SpellingDictionary { 35 | private Set learnedWords; 36 | 37 | public SpellingDictionary() { 38 | this.learnedWords = new HashSet<>(); 39 | } 40 | 41 | public void setLearnedWords(List words) { 42 | this.learnedWords = new HashSet<>(words); 43 | } 44 | 45 | public Set getLearnedWords() { 46 | return learnedWords; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/lqi/gui/renderer/LQIGridButtonRenderer.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.lqi.gui.renderer; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | 6 | import javax.swing.JButton; 7 | import javax.swing.JTable; 8 | import javax.swing.border.LineBorder; 9 | 10 | /** 11 | * Renderer for button cells of the LQI grid. 12 | */ 13 | public class LQIGridButtonRenderer extends ColorCellRenderer { 14 | 15 | /** Serial version UID. */ 16 | private static final long serialVersionUID = 1038383274543803328L; 17 | 18 | /** 19 | * Constructor. 20 | * @param color the background color. 21 | */ 22 | public LQIGridButtonRenderer(final Color color ) { 23 | super(color); 24 | } 25 | 26 | /* 27 | * (non-Javadoc) 28 | * @see com.vistatec.ocelot.lqi.gui.ColorCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int) 29 | */ 30 | @Override 31 | public Component getTableCellRendererComponent(JTable table, Object value, 32 | boolean isSelected, boolean hasFocus, int row, int column) { 33 | 34 | Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, 35 | row, column); 36 | JButton button = new JButton(); 37 | if(value != null){ 38 | button.setText(value.toString()); 39 | } 40 | button.setBackground(comp.getBackground()); 41 | button.setForeground(Color.gray); 42 | button.setBorder(new LineBorder(table.getGridColor())); 43 | return button; 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/lqi/gui/LQIGridButton.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.lqi.gui; 2 | 3 | import javax.swing.Action; 4 | import javax.swing.JButton; 5 | 6 | /** 7 | * Button used in the LQI grid. 8 | */ 9 | public class LQIGridButton extends JButton { 10 | 11 | /** Serial version UID. */ 12 | private static final long serialVersionUID = -1048939778142475738L; 13 | 14 | /** The category row for this button. */ 15 | private int categoryRow; 16 | 17 | /** The severity column for this button. */ 18 | private int severityColumn; 19 | 20 | /** 21 | * Constructor. 22 | * 23 | * @param annotAction 24 | * the action for this button. 25 | */ 26 | public LQIGridButton(final Action annotAction) { 27 | 28 | addActionListener(annotAction); 29 | } 30 | 31 | /** 32 | * Gets the category row. 33 | * 34 | * @return the category row. 35 | */ 36 | public int getCategoryRow() { 37 | return categoryRow; 38 | } 39 | 40 | /** 41 | * Sets the category row. 42 | * 43 | * @param categoryRow 44 | * the category row. 45 | */ 46 | public void setCategoryRow(int categoryRow) { 47 | this.categoryRow = categoryRow; 48 | } 49 | 50 | /** 51 | * Gets the severity column. 52 | * 53 | * @return the severity column. 54 | */ 55 | public int getSeverityColumn() { 56 | return severityColumn; 57 | } 58 | 59 | /** 60 | * Sets the severity column. 61 | * 62 | * @param severityColumn 63 | * the severity column. 64 | */ 65 | public void setSeverityColumn(int severityColumn) { 66 | this.severityColumn = severityColumn; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/lqi/gui/renderer/TextAreaColorCellRenderer.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.lqi.gui.renderer; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | 6 | import javax.swing.JTable; 7 | import javax.swing.JTextArea; 8 | 9 | /** 10 | * Table cell renderer displaying a text area. 11 | */ 12 | public class TextAreaColorCellRenderer extends ColorCellRenderer { 13 | 14 | /** The serial version UID. */ 15 | private static final long serialVersionUID = 8367564808375095337L; 16 | 17 | /** 18 | * Constructor. 19 | * @param color the background color for this cell. 20 | */ 21 | public TextAreaColorCellRenderer(Color color) { 22 | super(color); 23 | } 24 | 25 | /* 26 | * (non-Javadoc) 27 | * @see com.vistatec.ocelot.lqi.gui.ColorCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int) 28 | */ 29 | @Override 30 | public Component getTableCellRendererComponent(JTable table, Object value, 31 | boolean isSelected, boolean hasFocus, int row, int column) { 32 | 33 | Component comp = super.getTableCellRendererComponent(table, value, 34 | isSelected, hasFocus, row, column); 35 | JTextArea txtArea = new JTextArea(); 36 | if (value != null) { 37 | txtArea.setText((String) value); 38 | txtArea.setToolTipText((String) value); 39 | } 40 | txtArea.setSize(table.getColumnModel().getColumn(column).getWidth(), 41 | table.getRowHeight()); 42 | txtArea.setBackground(comp.getBackground()); 43 | txtArea.setLineWrap(true); 44 | txtArea.setWrapStyleWord(true); 45 | return txtArea; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/xliff/okapi/file_single_segm_2.0.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Sentence 1.LQI Sentence 2. 10 | 11 | 12 | 13 | 14 | 15 | Ph element #1. 16 | 17 | 18 | 19 | 20 | 21 | Pc element Important #1. 22 | 23 | 24 | 25 | 26 | 27 | \b 28 | \i 29 | \b0 30 | \i0 31 | 32 | 33 | Text in bold 34 | and italics. 35 | 36 | 37 | 38 | 39 | 40 | 41 | Mrk element Important #1. 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/segment/model/CodeAtom.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.segment.model; 2 | 3 | import com.vistatec.ocelot.segment.view.SegmentTextCell; 4 | 5 | import java.util.Objects; 6 | 7 | public class CodeAtom implements SegmentAtom { 8 | private String id; 9 | private String data, verboseData; 10 | 11 | public CodeAtom(String id, String data, String verboseData) { 12 | this.id = id; 13 | this.data = data; 14 | this.verboseData = verboseData; 15 | } 16 | 17 | public String getId() { 18 | return id; 19 | } 20 | 21 | @Override 22 | public int getLength() { 23 | return data.length(); 24 | } 25 | 26 | @Override 27 | public String getData() { 28 | return data; 29 | } 30 | 31 | public String getVerboseData() { 32 | return verboseData; 33 | } 34 | 35 | @Override 36 | public String getTextStyle() { 37 | return SegmentTextCell.tagStyle; 38 | } 39 | 40 | @Override 41 | public boolean equals(Object o) { 42 | if (o == this) return true; 43 | if (o == null || !(o instanceof CodeAtom)) return false; 44 | CodeAtom c = (CodeAtom)o; 45 | return Objects.equals(id, c.id) && 46 | Objects.equals(data, c.data) && 47 | Objects.equals(verboseData, c.verboseData); 48 | } 49 | 50 | @Override 51 | public int hashCode() { 52 | return Objects.hash(id, data, verboseData); 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return "[id=" + id + ", data='" + data + "', verbose='" + verboseData + "']"; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/tm/gui/match/AlternateRowsColorRenderer.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.tm.gui.match; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | 6 | import javax.swing.JTable; 7 | import javax.swing.table.DefaultTableCellRenderer; 8 | 9 | /** 10 | * Table Cell Renderer class, displaying table with alternate rows color. 11 | */ 12 | public class AlternateRowsColorRenderer extends DefaultTableCellRenderer { 13 | 14 | /** The serial version UID. */ 15 | private static final long serialVersionUID = -6117683543689824822L; 16 | 17 | /** Even rows color. */ 18 | private final Color evenRowColor = new Color(255, 255, 255); 19 | 20 | /** Odd row color. */ 21 | private final Color oddRowColor = new Color(240, 240, 240); 22 | 23 | /* 24 | * (non-Javadoc) 25 | * @see javax.swing.table.DefaultTableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int) 26 | */ 27 | @Override 28 | public Component getTableCellRendererComponent(JTable table, Object o, 29 | boolean isSelected, boolean hasFocus, int row, int col) { 30 | 31 | Component comp = super.getTableCellRendererComponent(table, o, 32 | isSelected, hasFocus, row, col); 33 | if (isSelected) { 34 | comp.setBackground(table.getSelectionBackground()); 35 | comp.setForeground(table.getSelectionForeground()); 36 | } else { 37 | if (row % 2 == 0) { 38 | //if even row, assign even color background 39 | comp.setBackground(evenRowColor); 40 | } else { 41 | //if odd row, assign odd color background 42 | comp.setBackground(oddRowColor); 43 | } 44 | } 45 | return comp; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/config/json/LingoTekConfig.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.config.json; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | 5 | /** 6 | * Configuration object for the LingoTek services. 7 | */ 8 | public class LingoTekConfig { 9 | 10 | /** The LingoTek CMS route. */ 11 | private String lingotekCMSRoute; 12 | 13 | /** The API key */ 14 | private String lgkAPIKey; 15 | 16 | /** 17 | * Sets the LingoTek CMS route. 18 | * 19 | * @param lingotekCMSRoute 20 | * the LingoTek CMS route. 21 | */ 22 | public void setLingotekCMSRoute(String lingotekCMSRoute) { 23 | this.lingotekCMSRoute = lingotekCMSRoute; 24 | } 25 | 26 | /** 27 | * Gets the LingoTek CMS route. 28 | * 29 | * @return the LingoTek CMS route. 30 | */ 31 | public String getLingotekCMSRoute() { 32 | return lingotekCMSRoute; 33 | } 34 | 35 | /** 36 | * Sets the API key. 37 | * 38 | * @param lgkAPIKey 39 | * the API key. 40 | */ 41 | public void setLgkAPIKey(String lgkAPIKey) { 42 | this.lgkAPIKey = lgkAPIKey; 43 | } 44 | 45 | /** 46 | * Gets the API key. 47 | * 48 | * @return the API key. 49 | */ 50 | public String getLgkAPIKey() { 51 | return lgkAPIKey; 52 | } 53 | 54 | /** 55 | * Checks if the configuration is completely defined. 56 | * 57 | * @return true if all configuration parameters are defined; 58 | * false if at least one parameter is missing. 59 | */ 60 | @JsonIgnore 61 | public boolean isComplete() { 62 | return lgkAPIKey != null && !lgkAPIKey.isEmpty() 63 | && lingotekCMSRoute != null && !lingotekCMSRoute.isEmpty(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/plugins/Plugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013, VistaTEC or third-party contributors as indicated 3 | * by the @author tags or express copyright attribution statements applied by 4 | * the authors. All third-party contributions are distributed under license by 5 | * VistaTEC. 6 | * 7 | * This file is part of Ocelot. 8 | * 9 | * Ocelot is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Ocelot is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with this program. If not, write to: 21 | * 22 | * Free Software Foundation, Inc. 23 | * 51 Franklin Street, Fifth Floor 24 | * Boston, MA 02110-1301 25 | * USA 26 | * 27 | * Also, see the full LGPL text here: 28 | */ 29 | package com.vistatec.ocelot.plugins; 30 | 31 | public interface Plugin { 32 | 33 | /** 34 | * Get the name of this plugin, for display in the Workbench UI. 35 | * @return plugin name 36 | */ 37 | public String getPluginName(); 38 | 39 | /** 40 | * Get the version of this plugin, for display in the Workbench UI. 41 | * @return plugin version 42 | */ 43 | public String getPluginVersion(); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/xliff/freme/helper/FremeXliffHelper.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.xliff.freme.helper; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.w3c.dom.Element; 7 | import org.w3c.dom.Node; 8 | 9 | import com.vistatec.ocelot.segment.model.OcelotSegment; 10 | import com.vistatec.ocelot.services.SegmentService; 11 | 12 | public abstract class FremeXliffHelper { 13 | 14 | public abstract String getUnitNodeName(); 15 | 16 | public int getSegmentNumber(String unitId, SegmentService segService) { 17 | 18 | int segNumber = -1; 19 | for(int i = 0; i getSegmentsForUnit(String unitId, 41 | SegmentService segService) { 42 | 43 | List segments = new ArrayList(); 44 | for(int i = 0; i 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Sentence 1.LQI Sentence 2. 10 | 11 | 12 | 13 | 14 | 15 | Ph element #1. 16 | 17 | 18 | 19 | 20 | 21 | This is a note for the segment s4 22 | 23 | 24 | Pc element Important #1. 25 | 26 | 27 | 28 | 29 | 30 | \b 31 | \i 32 | \b0 33 | \i0 34 | 35 | 36 | Text in bold 37 | and italics. 38 | 39 | 40 | 41 | 42 | 43 | 44 | Mrk element Important #1. 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/lqi/gui/renderer/ColorHeaderCellRenderer.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.lqi.gui.renderer; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | import java.awt.Font; 6 | 7 | import javax.swing.JLabel; 8 | import javax.swing.JTable; 9 | import javax.swing.SwingConstants; 10 | import javax.swing.border.LineBorder; 11 | 12 | /** 13 | * Renderer for LQI grid header. It displays header cells colored with a specific color. 14 | */ 15 | public class ColorHeaderCellRenderer extends ColorCellRenderer { 16 | 17 | /** Serial version UID. */ 18 | private static final long serialVersionUID = -7754518222953942417L; 19 | 20 | /** The cells border color. */ 21 | private Color borderColor; 22 | 23 | 24 | /** 25 | * Constructor. 26 | * @param color the background color. 27 | * @param borderColor the border color. 28 | */ 29 | public ColorHeaderCellRenderer(Color color, Color borderColor) { 30 | super(color); 31 | this.borderColor = borderColor; 32 | } 33 | 34 | /* 35 | * (non-Javadoc) 36 | * @see com.vistatec.ocelot.lqi.gui.ColorCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int) 37 | */ 38 | @Override 39 | public Component getTableCellRendererComponent(JTable table, Object value, 40 | boolean isSelected, boolean hasFocus, int row, int column) { 41 | JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, 42 | row, column); 43 | label.setBorder(new LineBorder(borderColor)); 44 | label.setFont(label.getFont().deriveFont(Font.BOLD)); 45 | label.setHorizontalAlignment(SwingConstants.CENTER); 46 | return label; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/plugins/freme/FremeEnrichmentOptions.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.plugins.freme; 2 | 3 | import java.awt.Component; 4 | import java.awt.Font; 5 | 6 | import javax.swing.JLabel; 7 | import javax.swing.JOptionPane; 8 | import javax.swing.JPanel; 9 | 10 | public class FremeEnrichmentOptions { 11 | 12 | public static final int DELETE_OPTION = 0; 13 | 14 | public static final int MERGE_OPTION = 1; 15 | 16 | public static final int CANCEL_OPTION = 2; 17 | 18 | public static int showConfirmDialog(Component parentComponent){ 19 | 20 | Object[] options = {"Delete", "Merge", "Cancel"}; 21 | return JOptionPane.showOptionDialog(parentComponent, getMessageComponent(), "Enrichment Options", 0, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); 22 | } 23 | 24 | private static Component getMessageComponent(){ 25 | 26 | // JOptionPane.sh 27 | String htmlMessage = "Existing enrichments have been detected.

Please choose one of the following options:
" 28 | + "Delete - delete existing enrichments and re-run the FREME pipeline;
" 29 | + "Merge - re-run the FREME pipeline and merge new enrichments with the existing ones. "; 30 | JLabel message = new JLabel(htmlMessage); 31 | message.setFont(new Font(message.getFont().getFontName(), Font.PLAIN, message.getFont().getSize())); 32 | JPanel panel = new JPanel(); 33 | panel.add(message); 34 | return panel; 35 | } 36 | 37 | 38 | // public static void main(String[] args) { 39 | // 40 | //// JOptionPane.s 41 | // JFrame frame = new JFrame(); 42 | // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 43 | // 44 | // frame.setLocationRelativeTo(null); 45 | // frame.setVisible(true); 46 | // System.out.println(showConfirmDialog(frame)); 47 | // } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/its/stats/model/TerminologyStats.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.its.stats.model; 2 | 3 | import java.util.Objects; 4 | 5 | public class TerminologyStats implements ITSStats { 6 | 7 | private Type type; 8 | private String value; 9 | private Integer count = 1; 10 | 11 | public enum Type { 12 | term, 13 | domain, 14 | annotatorsRef 15 | } 16 | 17 | public TerminologyStats() { 18 | } 19 | 20 | public TerminologyStats(Type type, String value) { 21 | 22 | this.type = type; 23 | this.value = value; 24 | } 25 | 26 | @Override 27 | public String getKey() { 28 | return getClass().getName() + ":" + type + ":" + value; 29 | } 30 | 31 | @Override 32 | public void combine(ITSStats stats) { 33 | count ++; 34 | } 35 | 36 | @Override 37 | public String getDataCategory() { 38 | return "Terminology"; 39 | } 40 | 41 | @Override 42 | public String getType() { 43 | return type.toString(); 44 | } 45 | 46 | @Override 47 | public String getValue() { 48 | return value; 49 | } 50 | 51 | @Override 52 | public Integer getCount() { 53 | return count; 54 | } 55 | 56 | @Override 57 | public void setCount(Integer count) { 58 | this.count = count; 59 | } 60 | 61 | @Override 62 | public boolean equals(Object o) { 63 | if (o == this) return true; 64 | if (o == null || !(o instanceof ProvenanceStats)) return false; 65 | ProvenanceStats prov = (ProvenanceStats)o; 66 | return Objects.equals(type, prov.getType()) && 67 | Objects.equals(value, prov.getValue()) && 68 | Objects.equals(count, prov.getCount()); 69 | } 70 | 71 | @Override 72 | public int hashCode() { 73 | return Objects.hash(type, value, count); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/xliff/okapi/file_single_segm_with_notes2.0.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | This is a note for the segment s1 10 | 11 | 12 | Sentence 1.LQI Sentence 2. 13 | 14 | 15 | 16 | 17 | 18 | Ph element #1. 19 | 20 | 21 | 22 | 23 | 24 | This is a note for the segment s4 25 | 26 | 27 | Pc element Important #1. 28 | 29 | 30 | 31 | 32 | 33 | \b 34 | \i 35 | \b0 36 | \i0 37 | 38 | 39 | Text in bold 40 | and italics. 41 | 42 | 43 | 44 | 45 | 46 | 47 | Mrk element Important #1. 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/segment/model/HighlightData.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.segment.model; 2 | 3 | 4 | /** 5 | * This class contains data of a highlighted string contained in a text atom. 6 | */ 7 | public class HighlightData { 8 | 9 | /** The atom index. */ 10 | private int atomIndex; 11 | 12 | /** The start and end indices of the highlighted string. */ 13 | private int[] highlightIndices; 14 | 15 | 16 | /** 17 | * Default constructor. 18 | */ 19 | public HighlightData() { 20 | } 21 | 22 | /** 23 | * Constructor. 24 | * 25 | * @param atomIndex 26 | * the atom index. 27 | * @param highlightIndices 28 | * the start and end indices of the highlighted string. 29 | */ 30 | public HighlightData(int atomIndex, int[] highlightIndices) { 31 | 32 | this.atomIndex = atomIndex; 33 | this.highlightIndices = highlightIndices; 34 | } 35 | 36 | /** 37 | * Gets the atom index. 38 | * 39 | * @return the atom index. 40 | */ 41 | public int getAtomIndex() { 42 | return atomIndex; 43 | 44 | } 45 | 46 | /** 47 | * Sets the atom index. 48 | * 49 | * @param atomIndex 50 | * the atom index. 51 | */ 52 | public void setAtomIndex(int atomIndex) { 53 | this.atomIndex = atomIndex; 54 | } 55 | 56 | /** 57 | * Gets the start and end indices of the highlighted string. 58 | * 59 | * @return the start and end indices of the highlighted string. 60 | */ 61 | public int[] getHighlightIndices() { 62 | return highlightIndices; 63 | } 64 | 65 | /** 66 | * Sets the start and end indices of the highlighted string. 67 | * 68 | * @param highlightIndices 69 | * the start and end indices of the highlighted string. 70 | */ 71 | public void setHighlightIndices(int[] highlightIndices) { 72 | this.highlightIndices = highlightIndices; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/test/resources/com/vistatec/ocelot/xliff/okapi/file_single_segm_with_notes_updated2.0.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | This is a note for the segment s1 edited 10 | 11 | 12 | Sentence 1.LQI Sentence 2. 13 | 14 | 15 | 16 | 17 | 18 | Ph element #1. 19 | 20 | 21 | 22 | 23 | 24 | This is a note for the segment s4 25 | 26 | 27 | Pc element Important #1. 28 | 29 | 30 | 31 | 32 | 33 | \b 34 | \i 35 | \b0 36 | \i0 37 | 38 | 39 | Text in bold 40 | and italics. 41 | 42 | 43 | 44 | 45 | 46 | 47 | Mrk element Important #1. 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/its/model/ITSMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013-2015, VistaTEC or third-party contributors as indicated 3 | * by the @author tags or express copyright attribution statements applied by 4 | * the authors. All third-party contributions are distributed under license by 5 | * VistaTEC. 6 | * 7 | * This file is part of Ocelot. 8 | * 9 | * Ocelot is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Ocelot is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with this program. If not, write to: 21 | * 22 | * Free Software Foundation, Inc. 23 | * 51 Franklin Street, Fifth Floor 24 | * Boston, MA 02110-1301 25 | * USA 26 | * 27 | * Also, see the full LGPL text here: 28 | */ 29 | package com.vistatec.ocelot.its.model; 30 | 31 | import com.vistatec.ocelot.rules.DataCategoryField; 32 | import com.vistatec.ocelot.rules.DataCategoryFlag; 33 | 34 | import java.util.Map; 35 | 36 | public abstract class ITSMetadata { 37 | private DataCategoryFlag flag = null; 38 | 39 | protected ITSMetadata() { } 40 | 41 | public abstract Map getFieldValues(); 42 | 43 | public DataCategoryFlag getFlag() { 44 | return flag; 45 | } 46 | 47 | public void setFlag(DataCategoryFlag flag) { 48 | this.flag = flag; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/segment/model/okapi/TaggedCodeAtom.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, VistaTEC or third-party contributors as indicated 3 | * by the @author tags or express copyright attribution statements applied by 4 | * the authors. All third-party contributions are distributed under license by 5 | * VistaTEC. 6 | * 7 | * This file is part of Ocelot. 8 | * 9 | * Ocelot is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Ocelot is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with this program. If not, write to: 21 | * 22 | * Free Software Foundation, Inc. 23 | * 51 Franklin Street, Fifth Floor 24 | * Boston, MA 02110-1301 25 | * USA 26 | * 27 | * Also, see the full LGPL text here: 28 | */ 29 | package com.vistatec.ocelot.segment.model.okapi; 30 | 31 | import com.vistatec.ocelot.segment.model.CodeAtom; 32 | 33 | import net.sf.okapi.lib.xliff2.core.Tag; 34 | 35 | /** 36 | * XLIFF 2.0 CodeAtom, tracks which Okapi Tag the code atom was created from. 37 | */ 38 | public class TaggedCodeAtom extends CodeAtom { 39 | private Tag tag; 40 | 41 | public TaggedCodeAtom(Tag tag, String data, String verboseData) { 42 | super(tag.getId(), data, verboseData); 43 | this.tag = tag; 44 | } 45 | 46 | public Tag getTag() { 47 | return this.tag; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/its/stats/model/TextAnalysisStats.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.its.stats.model; 2 | 3 | import java.util.Objects; 4 | 5 | public class TextAnalysisStats implements ITSStats { 6 | 7 | private Integer count = 1; 8 | 9 | private Type type; 10 | 11 | private String value; 12 | 13 | public enum Type { 14 | 15 | taConfidence, 16 | taClassRef, 17 | taIdentRef, 18 | annotatorsRef 19 | } 20 | 21 | public TextAnalysisStats() { 22 | } 23 | 24 | public TextAnalysisStats(Type type, String value) { 25 | 26 | this.type = type; 27 | this.value = value; 28 | } 29 | 30 | @Override 31 | public String getKey() { 32 | return getClass().getName() + ":" + type + ":" + value; 33 | } 34 | 35 | @Override 36 | public void combine(ITSStats stats) { 37 | count++; 38 | 39 | } 40 | 41 | @Override 42 | public String getDataCategory() { 43 | 44 | return "Text-Analysis"; 45 | } 46 | 47 | @Override 48 | public String getType() { 49 | return type.toString(); 50 | } 51 | 52 | @Override 53 | public String getValue() { 54 | return value; 55 | } 56 | 57 | @Override 58 | public Integer getCount() { 59 | return count; 60 | } 61 | 62 | @Override 63 | public void setCount(Integer count) { 64 | 65 | this.count = count; 66 | } 67 | 68 | @Override 69 | public boolean equals(Object o) { 70 | if (o == this) return true; 71 | if (o == null || !(o instanceof ProvenanceStats)) return false; 72 | ProvenanceStats prov = (ProvenanceStats)o; 73 | return Objects.equals(type, prov.getType()) && 74 | Objects.equals(value, prov.getValue()) && 75 | Objects.equals(count, prov.getCount()); 76 | } 77 | 78 | @Override 79 | public int hashCode() { 80 | return Objects.hash(type, value, count); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/rules/RuleListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013, VistaTEC or third-party contributors as indicated 3 | * by the @author tags or express copyright attribution statements applied by 4 | * the authors. All third-party contributions are distributed under license by 5 | * VistaTEC. 6 | * 7 | * This file is part of Ocelot. 8 | * 9 | * Ocelot is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Ocelot is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with this program. If not, write to: 21 | * 22 | * Free Software Foundation, Inc. 23 | * 51 Franklin Street, Fifth Floor 24 | * Boston, MA 02110-1301 25 | * USA 26 | * 27 | * Also, see the full LGPL text here: 28 | */ 29 | package com.vistatec.ocelot.rules; 30 | 31 | /** 32 | * Listens for changes in Rule configuration. 33 | */ 34 | public interface RuleListener { 35 | 36 | /** 37 | * Notify if a Rule has been enabled or disabled. 38 | */ 39 | public void enabledRule(String ruleLabel, boolean enabled); 40 | 41 | /** 42 | * Notify that the filter mode has changed. 43 | */ 44 | public void setFilterMode(RuleConfiguration.FilterMode filterMode); 45 | 46 | /** 47 | * Notify that the state qualifier mode has changed. 48 | */ 49 | public void setStateQualifierMode(RuleConfiguration.StateQualifierMode mode); 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/rules/StateQualifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014, VistaTEC or third-party contributors as indicated 3 | * by the @author tags or express copyright attribution statements applied by 4 | * the authors. All third-party contributions are distributed under license by 5 | * VistaTEC. 6 | * 7 | * This file is part of Ocelot. 8 | * 9 | * Ocelot is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Ocelot is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with this program. If not, write to: 21 | * 22 | * Free Software Foundation, Inc. 23 | * 51 Franklin Street, Fifth Floor 24 | * Boston, MA 02110-1301 25 | * USA 26 | * 27 | * Also, see the full LGPL text here: 28 | */ 29 | package com.vistatec.ocelot.rules; 30 | 31 | public enum StateQualifier { 32 | ID("id-match"), 33 | EXACT("exact-match"), 34 | FUZZY("fuzzy-match"), 35 | MT("mt-suggestion"); 36 | 37 | private String name; 38 | 39 | private StateQualifier(String name) { 40 | this.name = name; 41 | } 42 | 43 | public String getName() { 44 | return this.name; 45 | } 46 | 47 | public static StateQualifier get(String name) { 48 | for (StateQualifier sq : values()) { 49 | if (sq.getName().equals(name)) { 50 | return sq; 51 | } 52 | } 53 | return null; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/lqi/gui/editor/FloatCellEditor.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.lqi.gui.editor; 2 | 3 | import java.awt.Component; 4 | import java.awt.event.KeyAdapter; 5 | import java.awt.event.KeyEvent; 6 | 7 | import javax.swing.DefaultCellEditor; 8 | import javax.swing.JTable; 9 | import javax.swing.JTextField; 10 | 11 | import com.vistatec.ocelot.lqi.gui.FloatDocument; 12 | 13 | /** 14 | * Cell editor letting users only insert float values. 15 | */ 16 | public class FloatCellEditor extends DefaultCellEditor { 17 | 18 | /** The serial version UID. */ 19 | private static final long serialVersionUID = -7583459009569524787L; 20 | 21 | /** The float document. */ 22 | private FloatDocument document; 23 | 24 | /** The text field being the editor component. */ 25 | private JTextField editorComp; 26 | 27 | 28 | /** 29 | * Constructor. 30 | */ 31 | public FloatCellEditor() { 32 | super(new JTextField()); 33 | document = new FloatDocument(); 34 | } 35 | 36 | /* 37 | * (non-Javadoc) 38 | * @see javax.swing.DefaultCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int) 39 | */ 40 | @Override 41 | public Component getTableCellEditorComponent(JTable table, Object value, 42 | boolean isSelected, int row, int column) { 43 | editorComp = (JTextField) super.getTableCellEditorComponent(table, value, isSelected, row, column); 44 | editorComp.setDocument(document); 45 | editorComp.addKeyListener(new KeyAdapter() { 46 | 47 | @Override 48 | public void keyPressed(KeyEvent e) { 49 | if(e.getKeyCode() == KeyEvent.VK_ENTER){ 50 | stopCellEditing(); 51 | } 52 | } 53 | }); 54 | return editorComp; 55 | } 56 | 57 | /* 58 | * (non-Javadoc) 59 | * @see javax.swing.DefaultCellEditor#getCellEditorValue() 60 | */ 61 | @Override 62 | public Object getCellEditorValue() { 63 | return editorComp.getText(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/vistatec/ocelot/services/OkapiXLIFFDocument.java: -------------------------------------------------------------------------------- 1 | package com.vistatec.ocelot.services; 2 | 3 | import java.io.File; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import com.vistatec.ocelot.segment.model.OcelotSegment; 8 | import com.vistatec.ocelot.xliff.XLIFFDocument; 9 | import com.vistatec.ocelot.xliff.XLIFFParser; 10 | import com.vistatec.ocelot.xliff.XLIFFVersion; 11 | import com.vistatec.ocelot.xliff.XLIFFWriter; 12 | 13 | import net.sf.okapi.common.LocaleId; 14 | 15 | class OkapiXLIFFDocument implements XLIFFDocument { 16 | private File file; 17 | private XLIFFVersion version; 18 | private LocaleId srcLocale; 19 | private LocaleId tgtLocale; 20 | private String original; 21 | private XLIFFParser parser; 22 | private XLIFFWriter writer; 23 | private List segments = new ArrayList<>(); 24 | 25 | OkapiXLIFFDocument(File file, XLIFFVersion version, LocaleId srcLocale, LocaleId tgtLocale, String original, 26 | List segments, XLIFFParser parser, XLIFFWriter writer) { 27 | this.file = file; 28 | this.version = version; 29 | this.srcLocale = srcLocale; 30 | this.tgtLocale = tgtLocale; 31 | this.original = original; 32 | this.parser = parser; 33 | this.writer = writer; 34 | this.segments = segments; 35 | } 36 | 37 | public File getFile() { 38 | return file; 39 | } 40 | 41 | public XLIFFVersion getVersion() { 42 | return version; 43 | } 44 | 45 | public LocaleId getSrcLocale() { 46 | return srcLocale; 47 | } 48 | 49 | public LocaleId getTgtLocale() { 50 | return tgtLocale; 51 | } 52 | 53 | public List getSegments() { 54 | return segments; 55 | } 56 | 57 | XLIFFParser getParser() { 58 | return parser; 59 | } 60 | 61 | XLIFFWriter getWriter() { 62 | return writer; 63 | } 64 | 65 | @Override 66 | public String getOriginal() { 67 | return original; 68 | } 69 | } 70 | --------------------------------------------------------------------------------