Class Configuration

java.lang.Object
org.languagetool.gui.Configuration

public class Configuration extends Object
Configuration like list of disabled rule IDs, server mode etc. Configuration is loaded from and stored to a properties file.
  • Field Details

  • Constructor Details

  • Method Details

    • initOptions

      public void initOptions()
      Initialize variables and clears Maps, Sets and Lists
    • copy

      Configuration copy(Configuration configuration)
      Returns a copy of the given configuration.
      Parameters:
      configuration - the object to copy.
      Since:
      2.6
    • restoreState

      void restoreState(Configuration configuration)
      Restore the state of this object from configuration.
      Parameters:
      configuration - the object from which we will read the state
      Since:
      2.6
    • setConfigFile

      public void setConfigFile(File configFile)
    • getDisabledRuleIds

      public Set<String> getDisabledRuleIds()
    • getEnabledRuleIds

      public Set<String> getEnabledRuleIds()
    • getDisabledCategoryNames

      public Set<String> getDisabledCategoryNames()
    • getEnabledCategoryNames

      public Set<String> getEnabledCategoryNames()
    • setDisabledRuleIds

      public void setDisabledRuleIds(Set<String> ruleIds)
    • addDisabledRuleIds

      public void addDisabledRuleIds(Set<String> ruleIds)
    • removeDisabledRuleIds

      public void removeDisabledRuleIds(Set<String> ruleIds)
    • removeDisabledRuleId

      public void removeDisabledRuleId(String ruleId)
    • removeEnabledRuleId

      public void removeEnabledRuleId(String ruleId)
    • setEnabledRuleIds

      public void setEnabledRuleIds(Set<String> ruleIds)
    • setDisabledCategoryNames

      public void setDisabledCategoryNames(Set<String> categoryNames)
    • setEnabledCategoryNames

      public void setEnabledCategoryNames(Set<String> categoryNames)
    • getEnabledRulesOnly

      public boolean getEnabledRulesOnly()
    • getLanguage

      public Language getLanguage()
    • setLanguage

      public void setLanguage(Language language)
    • getMotherTongue

      public Language getMotherTongue()
    • setMotherTongue

      public void setMotherTongue(Language motherTongue)
    • getFixedLanguage

      public Language getFixedLanguage()
    • setFixedLanguage

      public void setFixedLanguage(Language fixedLanguage)
    • getDefaultLanguage

      public Language getDefaultLanguage()
    • setUseDocLanguage

      public void setUseDocLanguage(boolean useDocLang)
    • getUseDocLanguage

      public boolean getUseDocLanguage()
    • getAutoDetect

      public boolean getAutoDetect()
    • setAutoDetect

      public void setAutoDetect(boolean autoDetect)
    • setRemoteCheck

      public void setRemoteCheck(boolean doRemoteCheck)
    • doRemoteCheck

      public boolean doRemoteCheck()
    • setUseOtherServer

      public void setUseOtherServer(boolean useOtherServer)
    • useOtherServer

      public boolean useOtherServer()
    • setPremium

      public void setPremium(boolean isPremium)
    • isPremium

      public boolean isPremium()
    • setOtherServerUrl

      public void setOtherServerUrl(String otherServerUrl)
    • getServerUrl

      public String getServerUrl()
    • setRemoteUsername

      public void setRemoteUsername(String remoteUsername)
    • getRemoteUsername

      public String getRemoteUsername()
    • setRemoteApiKey

      public void setRemoteApiKey(String remoteApiKey)
    • aiUrl

      public String aiUrl()
    • setAiUrl

      public void setAiUrl(String aiUrl)
    • aiModel

      public String aiModel()
    • setAiModel

      public void setAiModel(String aiModel)
    • aiApiKey

      public String aiApiKey()
    • setAiApiKey

      public void setAiApiKey(String aiApiKey)
    • useAiSupport

      public boolean useAiSupport()
    • setUseAiSupport

      public void setUseAiSupport(boolean useAiSupport)
    • aiAutoCorrect

      public boolean aiAutoCorrect()
    • setAiAutoCorrect

      public void setAiAutoCorrect(boolean aiAutoCorrect)
    • aiShowStylisticChanges

      public boolean aiShowStylisticChanges()
    • setAiShowStylisticChanges

      public void setAiShowStylisticChanges(boolean aiShowStylisticChanges)
    • getRemoteApiKey

      public String getRemoteApiKey()
    • getlogLevel

      public String getlogLevel()
    • setMarkSingleCharBold

      public void setMarkSingleCharBold(boolean markSingleCharBold)
    • markSingleCharBold

      public boolean markSingleCharBold()
    • setUseLtSpellChecker

      public void setUseLtSpellChecker(boolean useLtSpellChecker)
    • useLtSpellChecker

      public boolean useLtSpellChecker()
    • setNoSynonymsAsSuggestions

      public void setNoSynonymsAsSuggestions(boolean noSynonymsAsSuggestions)
    • noSynonymsAsSuggestions

      public boolean noSynonymsAsSuggestions()
    • setIncludeTrackedChanges

      public void setIncludeTrackedChanges(boolean includeTrackedChanges)
    • includeTrackedChanges

      public boolean includeTrackedChanges()
    • setEnableTmpOffRules

      public void setEnableTmpOffRules(boolean enableTmpOffRules)
    • enableTmpOffRules

      public boolean enableTmpOffRules()
    • setEnableGoalSpecificRules

      public void setEnableGoalSpecificRules(boolean enableGoalSpecificRules)
    • enableGoalSpecificRules

      public boolean enableGoalSpecificRules()
    • setFilterOverlappingMatches

      public void setFilterOverlappingMatches(boolean filterOverlappingMatches)
    • filterOverlappingMatches

      public boolean filterOverlappingMatches()
    • setSaveLoCache

      public void setSaveLoCache(boolean saveLoCache)
    • saveLoCache

      public boolean saveLoCache()
    • getTaggerShowsDisambigLog

      public boolean getTaggerShowsDisambigLog()
      Determines whether the tagger window will also print the disambiguation log.
      Returns:
      true if the tagger window will print the disambiguation log, false otherwise
      Since:
      3.3
    • setTaggerShowsDisambigLog

      public void setTaggerShowsDisambigLog(boolean taggerShowsDisambigLog)
      Enables or disables the disambiguation log on the tagger window, depending on the value of the parameter taggerShowsDisambigLog.
      Parameters:
      taggerShowsDisambigLog - If true, the tagger window will print the
      Since:
      3.3
    • getRunServer

      public boolean getRunServer()
    • setRunServer

      public void setRunServer(boolean runServer)
    • getServerPort

      public int getServerPort()
    • setUseGUIConfig

      public void setUseGUIConfig(boolean useGUIConfig)
    • getUseGUIConfig

      public boolean getUseGUIConfig()
    • setServerPort

      public void setServerPort(int serverPort)
    • getExternalRuleDirectory

      public String getExternalRuleDirectory()
    • setExternalRuleDirectory

      public void setExternalRuleDirectory(String path)
    • getNumParasToCheck

      public int getNumParasToCheck()
      get the number of paragraphs to be checked for TextLevelRules
      Since:
      4.0
    • setNumParasToCheck

      public void setNumParasToCheck(int numParas)
      set the number of paragraphs to be checked for TextLevelRules
      Since:
      4.0
    • isResetCheck

      public boolean isResetCheck()
      will all paragraphs check after every change of text?
      Since:
      4.2
    • setDoResetCheck

      public void setDoResetCheck(boolean resetCheck)
      set all paragraphs to be checked after every change of text
      Since:
      4.2
    • useTextLevelQueue

      public boolean useTextLevelQueue()
      will all paragraphs not checked after every change of text if more than one document loaded?
      Since:
      4.5
    • setUseTextLevelQueue

      public void setUseTextLevelQueue(boolean useTextLevelQueue)
      set all paragraphs to be not checked after every change of text if more than one document loaded?
      Since:
      4.5
    • setNoBackgroundCheck

      public void setNoBackgroundCheck(boolean noBackgroundCheck)
      set option to switch off background check if true: LT engine is switched of (no marks inside of document)
      Since:
      5.2
    • saveNoBackgroundCheck

      public void saveNoBackgroundCheck(boolean noBackgroundCheck, Language lang) throws IOException
      set option to switch off background check and save configuration
      Throws:
      IOException
      Since:
      5.2
    • noBackgroundCheck

      public boolean noBackgroundCheck()
      return true if background check is switched of (no marks inside of document)
      Since:
      5.2
    • getCurrentProfile

      public String getCurrentProfile()
      get the current profile
      Since:
      4.7
    • setCurrentProfile

      public void setCurrentProfile(String profile)
      set the current profile
      Since:
      4.7
    • getDefinedProfiles

      public List<String> getDefinedProfiles()
      get the current profile
      Since:
      4.7
    • addProfile

      public void addProfile(String profile)
      add a new profile
      Since:
      4.7
    • addProfiles

      public void addProfiles(List<String> profiles)
      add a list of profiles
      Since:
      4.7
    • removeProfile

      public void removeProfile(String profile)
      remove an existing profile
      Since:
      4.7
    • setMultiThreadLO

      public void setMultiThreadLO(boolean isMultiThread)
      run LO in multi thread mode
      Since:
      4.6
    • isMultiThread

      public boolean isMultiThread()
      shall LO run in multi thread mode
      Since:
      4.6
    • getFontName

      public String getFontName()
      Returns the name of the GUI's editing textarea font.
      Returns:
      the name of the font.
      Since:
      2.6
      See Also:
    • setFontName

      public void setFontName(String fontName)
      Sets the name of the GUI's editing textarea font.
      Parameters:
      fontName - the name of the font.
      Since:
      2.6
      See Also:
    • getFontStyle

      public int getFontStyle()
      Returns the style of the GUI's editing textarea font.
      Returns:
      the style of the font.
      Since:
      2.6
      See Also:
    • setFontStyle

      public void setFontStyle(int fontStyle)
      Sets the style of the GUI's editing textarea font.
      Parameters:
      fontStyle - the style of the font.
      Since:
      2.6
      See Also:
    • getFontSize

      public int getFontSize()
      Returns the size of the GUI's editing textarea font.
      Returns:
      the size of the font.
      Since:
      2.6
      See Also:
    • setFontSize

      public void setFontSize(int fontSize)
      Sets the size of the GUI's editing textarea font.
      Parameters:
      fontSize - the size of the font.
      Since:
      2.6
      See Also:
    • getLookAndFeelName

      public String getLookAndFeelName()
      Returns the name of the GUI's LaF.
      Returns:
      the name of the LaF.
      Since:
      2.6
      See Also:
    • setLookAndFeelName

      public void setLookAndFeelName(String lookAndFeelName)
      Sets the name of the GUI's LaF.
      Parameters:
      lookAndFeelName - the name of the LaF.
      Since:
      2.6 @see
      See Also:
    • getNgramDirectory

      @Nullable public File getNgramDirectory()
      Directory with ngram data or null.
      Since:
      3.0
    • setNgramDirectory

      public void setNgramDirectory(File dir)
      Sets the directory with ngram data (may be null).
      Since:
      3.0
    • getErrorColors

      public Map<ITSIssueType,Color> getErrorColors()
      Since:
      2.8
    • isStyleCategory

      public boolean isStyleCategory(String category)
      Since:
      4.3 Returns true if category is style like
    • initStyleCategories

      public void initStyleCategories(List<Rule> allRules)
      Since:
      4.4 Initialize set of style like categories
    • isSpecialTabCategory

      public boolean isSpecialTabCategory(String category)
      Since:
      4.3 Returns true if category is a special Tab category
    • isInSpecialTab

      public boolean isInSpecialTab(String category, String tabName)
      Since:
      4.3 Returns true if category is member of named special Tab
    • getSpecialTabNames

      public String[] getSpecialTabNames()
      Since:
      4.3 Returns all special tab names
    • getSpecialTabCategories

      public Set<String> getSpecialTabCategories(String tabName)
      Since:
      4.3 Returns all categories for a named special tab
    • getUnderlineColors

      public Map<String,Color> getUnderlineColors()
      Since:
      4.2
    • getUnderlineRuleColors

      public Map<String,Color> getUnderlineRuleColors()
      Since:
      5.3
    • getUnderlineColor

      public Color getUnderlineColor(String category, String ruleId)
      Since:
      4.2 Get the color to underline a rule match by the Name of its category
    • setUnderlineColor

      public void setUnderlineColor(String category, Color col)
      Since:
      4.2 Set the color to underline a rule match for its category
    • setUnderlineRuleColor

      public void setUnderlineRuleColor(String ruleId, Color col)
      Since:
      5.3 Set the color to underline a rule match for this rule
    • setDefaultUnderlineColor

      public void setDefaultUnderlineColor(String category)
      Since:
      4.2 Set the category color back to default (removes category from map)
    • setDefaultUnderlineRuleColor

      public void setDefaultUnderlineRuleColor(String ruleId)
      Since:
      5.3 Set the category color back to default (removes category from map)
    • getUnderlineTypes

      public Map<String,Short> getUnderlineTypes()
      Since:
      4.9
    • getUnderlineRuleTypes

      public Map<String,Short> getUnderlineRuleTypes()
      Since:
      5.3
    • getUnderlineType

      public Short getUnderlineType(String category, String ruleId)
      Since:
      4.9 Get the type to underline a rule match by the Name of its category
    • setUnderlineType

      public void setUnderlineType(String category, short type)
      Since:
      4.9 Set the type to underline a rule match for its category
    • setUnderlineRuleType

      public void setUnderlineRuleType(String ruleID, short type)
      Since:
      5.3 Set the type to underline a rule match
    • setDefaultUnderlineType

      public void setDefaultUnderlineType(String category)
      Since:
      4.9 Set the type back to default (removes category from map)
    • setDefaultUnderlineRuleType

      public void setDefaultUnderlineRuleType(String ruleID)
      Since:
      5.3 Set the type back to default (removes ruleId from map)
    • getConfigurableValues

      public Map<String,Object[]> getConfigurableValues()
      returns all configured values
      Since:
      4.2
    • getConfigValueByID

      public <T> T getConfigValueByID(String ruleID, int index, Class<T> clazz, T defaultValue)
      Get the configurable value of a rule by ruleID returns default value if no value is set by configuration
      Since:
      6.5
    • setConfigurableValue

      public void setConfigurableValue(String ruleID, Object[] values)
      Set the values for a rule by ruleID
      Since:
      6.5
    • removeConfigurableValue

      public void removeConfigurableValue(String ruleID)
      Remove the configuration values of a rule by ruleID
      Since:
      6.5
    • onlySingleParagraphMode

      public boolean onlySingleParagraphMode()
      only single paragraph mode can be used (for OO and old LO
      Since:
      5.6
    • isValidServerUrl

      public boolean isValidServerUrl(String url)
      Test if http-server URL is correct
    • isValidAiServerUrl

      public boolean isValidAiServerUrl(String url)
    • loadConfiguration

      private void loadConfiguration() throws IOException
      Throws:
      IOException
    • loadConfiguration

      public void loadConfiguration(String profile) throws IOException
      Throws:
      IOException
    • loadCurrentProfile

      private void loadCurrentProfile(Properties props, String prefix, String qualifier)
    • parseErrorColors

      private void parseErrorColors(String colorsString)
    • parseUnderlineColors

      private void parseUnderlineColors(String colorsString, Map<String,Color> underlineColors)
    • parseUnderlineTypes

      private void parseUnderlineTypes(String typessString, Map<String,Short> underlineTypes)
    • parseConfigurableRuleValues

      private void parseConfigurableRuleValues(String rulesValueString)
    • getQualifier

      private String getQualifier(Language lang)
    • loadConfigForOtherLanguages

      private void loadConfigForOtherLanguages(Language lang, Properties prop, String prefix)
    • storeConfigKeyFromProp

      private void storeConfigKeyFromProp(Properties prop, String key)
    • getListFromProperties

      private Collection<? extends String> getListFromProperties(Properties props, String key)
    • saveConfiguration

      public void saveConfiguration(Language lang) throws IOException
      Throws:
      IOException
    • addListToProperties

      private void addListToProperties(Properties props, String key, Set<String> list)
    • setAllProfileKeys

      private void setAllProfileKeys()
    • storeConfigForAllProfiles

      private void storeConfigForAllProfiles(Properties props)
    • saveConfigForCurrentProfile

      private void saveConfigForCurrentProfile(Properties props, String prefix, String qualifier)
    • saveConfigForProfile

      private void saveConfigForProfile(Properties props, String prefix)
    • importProfile

      public void importProfile(File importFile) throws IOException
      Throws:
      IOException
    • exportProfile

      public void exportProfile(String profile, File exportFile) throws IOException
      Throws:
      IOException