Class Configuration
java.lang.Object
org.languagetool.gui.Configuration
Configuration like list of disabled rule IDs, server mode etc.
Configuration is loaded from and stored to a properties file.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate booleanprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate Fileprivate static final Stringprivate static final Stringprivate static final Stringprivate String(package private) static final int(package private) static final intprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate booleanprivate booleanprivate booleanprivate static final Stringprivate static final Stringprivate static final Stringprivate booleanprivate static final Stringprivate static final Stringprivate Stringprivate static final String(package private) static final intprivate static final String(package private) static final intprivate static final Stringprivate Stringprivate intprivate intprivate booleanprivate static final Stringprivate booleanprivate org.languagetool.Languageprivate org.languagetool.Languageprivate static final Stringprivate static final Stringprivate Stringprivate static final Stringprivate static final Stringprivate org.languagetool.Languageprivate static final Stringprivate Fileprivate static final Stringprivate booleanprivate intprivate Fileprivate static final Stringprivate Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate booleanprivate static final Stringprivate static final Stringprivate int(package private) static final Colorprivate booleanprivate static final Stringprivate booleanprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate booleanprivate booleanprivate static final Stringprivate File -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateConfiguration(File baseDir, String filename, File oldConfigFile, org.languagetool.Language lang, org.languagetool.LinguServices linguServices) Configuration(File baseDir, String filename, org.languagetool.Language lang) Configuration(File baseDir, String filename, org.languagetool.Language lang, org.languagetool.LinguServices linguServices) Configuration(File baseDir, org.languagetool.Language lang) Configuration(org.languagetool.Language lang) Uses the configuration file from the default location. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDisabledRuleIds(Set<String> ruleIds) private voidaddListToProperties(Properties props, String key, Set<String> list) voidaddProfile(String profile) add a new profilevoidaddProfiles(List<String> profiles) add a list of profiles(package private) Configurationcopy(Configuration configuration) Returns a copy of the given configuration.booleando a full check at first iteration?booleanbooleanintgetConfigurableValue(String ruleID) returns all configured valuesget the current profileorg.languagetool.Languageget the current profilebooleanReturns the name of the GUI's editing textarea font.intReturns the size of the GUI's editing textarea font.intReturns the style of the GUI's editing textarea font.org.languagetool.Languageprivate Collection<? extends String> getListFromProperties(Properties props, String key) Returns the name of the GUI's LaF.org.languagetool.Language@Nullable FileDirectory with ngram data or null.intget the number of paragraphs to be checked for TextLevelRulesprivate StringgetQualifier(org.languagetool.Language lang) booleanintgetSpecialTabCategories(String tabName) String[]booleanDetermines whether the tagger window will also print the disambiguation log.getUnderlineColor(String category) booleanboolean@Nullable FileDirectory with word2vec data or null.voidInitialize variables and clears Maps, Sets and ListsvoidinitStyleCategories(List<org.languagetool.rules.Rule> allRules) booleanisInSpecialTab(String category, String tabName) booleanshall LO run in multi thread modebooleanwill all paragraphs not checked after every change of text if more than one document loaded?booleanwill all paragraphs check after every change of text?booleanisSpecialTabCategory(String category) booleanisStyleCategory(String category) booleanprivate voidloadConfigForOtherLanguages(org.languagetool.Language lang, Properties prop, String prefix) private voidvoidloadConfiguration(String profile) private voidparseConfigurableRuleValues(String rulesValueString) private voidparseErrorColors(String colorsString) private voidparseUnderlineColors(String colorsString) voidremoveDisabledRuleIds(Set<String> ruleIds) voidremoveProfile(String profile) remove an existing profile(package private) voidrestoreState(Configuration configuration) Restore the state of this object from configuration.private voidsaveConfigforProfile(Properties props, String prefix) voidsaveConfiguration(org.languagetool.Language lang) private voidvoidsetAutoDetect(boolean autoDetect) voidsetConfigurableValue(String ruleID, int value) voidsetCurrentProfile(String profile) set the current profilevoidsetDefaultUnderlineColor(String category) voidsetDisabledCategoryNames(Set<String> categoryNames) voidsetDisabledRuleIds(Set<String> ruleIds) voidsetDoResetCheck(boolean resetCheck) set all paragraphs to be checked after every change of textvoidsetEnabledCategoryNames(Set<String> categoryNames) voidsetEnabledRuleIds(Set<String> ruleIds) voidvoidsetFontName(String fontName) Sets the name of the GUI's editing textarea font.voidsetFontSize(int fontSize) Sets the size of the GUI's editing textarea font.voidsetFontStyle(int fontStyle) Sets the style of the GUI's editing textarea font.voidsetFullCheckAtFirst(boolean doFullCheckAtFirst) set option to do a full check at first iterationvoidsetLanguage(org.languagetool.Language language) voidsetLookAndFeelName(String lookAndFeelName) Sets the name of the GUI's LaF.voidsetMotherTongue(org.languagetool.Language motherTongue) voidsetMultiThreadLO(boolean isMultiThread) run LO in multi thread modevoidsetNgramDirectory(File dir) Sets the directory with ngram data (may be null).voidsetNoMultiReset(boolean noMultiReset) set all paragraphs to be not checked after every change of text if more than one document loaded?voidsetNumParasToCheck(int numParas) set the number of paragraphs to be checked for TextLevelRulesvoidsetOtherServerUrl(String otherServerUrl) voidsetRemoteCheck(boolean doRemoteCheck) voidsetRunServer(boolean runServer) voidsetServerPort(int serverPort) voidsetSwitchedOff(boolean switchOff, org.languagetool.Language lang) voidsetTaggerShowsDisambigLog(boolean taggerShowsDisambigLog) Enables or disables the disambiguation log on the tagger window, depending on the value of the parameter taggerShowsDisambigLog.voidsetUnderlineColor(String category, Color col) voidsetUseDocLanguage(boolean useDocLang) voidsetUseGUIConfig(boolean useGUIConfig) voidsetUseOtherServer(boolean useOtherServer) voidsetWord2VecDirectory(File dir) Sets the directory with word2vec data (may be null).private voidprivate voidstoreConfigKeyFromProp(Properties prop, String key) boolean
-
Field Details
-
DEFAULT_SERVER_PORT
static final int DEFAULT_SERVER_PORT- See Also:
-
DEFAULT_NUM_CHECK_PARAS
static final int DEFAULT_NUM_CHECK_PARAS- See Also:
-
FONT_STYLE_INVALID
static final int FONT_STYLE_INVALID- See Also:
-
FONT_SIZE_INVALID
static final int FONT_SIZE_INVALID- See Also:
-
STYLE_COLOR
-
CONFIG_FILE
- See Also:
-
CURRENT_PROFILE_KEY
- See Also:
-
DEFINED_PROFILES_KEY
- See Also:
-
DISABLED_RULES_KEY
- See Also:
-
ENABLED_RULES_KEY
- See Also:
-
DISABLED_CATEGORIES_KEY
- See Also:
-
ENABLED_CATEGORIES_KEY
- See Also:
-
ENABLED_RULES_ONLY_KEY
- See Also:
-
LANGUAGE_KEY
- See Also:
-
MOTHER_TONGUE_KEY
- See Also:
-
NGRAM_DIR_KEY
- See Also:
-
WORD2VEC_DIR_KEY
- See Also:
-
AUTO_DETECT_KEY
- See Also:
-
TAGGER_SHOWS_DISAMBIG_LOG_KEY
- See Also:
-
SERVER_RUN_KEY
- See Also:
-
SERVER_PORT_KEY
- See Also:
-
PARA_CHECK_KEY
- See Also:
-
RESET_CHECK_KEY
- See Also:
-
NO_MULTI_RESET_KEY
- See Also:
-
DO_FULL_CHECK_AT_FIRST_KEY
- See Also:
-
USE_DOC_LANG_KEY
- See Also:
-
USE_GUI_KEY
- See Also:
-
FONT_NAME_KEY
- See Also:
-
FONT_STYLE_KEY
- See Also:
-
FONT_SIZE_KEY
- See Also:
-
LF_NAME_KEY
- See Also:
-
ERROR_COLORS_KEY
- See Also:
-
UNDERLINE_COLORS_KEY
- See Also:
-
CONFIGURABLE_RULE_VALUES_KEY
- See Also:
-
LT_SWITCHED_OFF_KEY
- See Also:
-
IS_MULTI_THREAD_LO_KEY
- See Also:
-
EXTERNAL_RULE_DIRECTORY
- See Also:
-
DO_REMOTE_CHECK_KEY
- See Also:
-
OTHER_SERVER_URL_KEY
- See Also:
-
USE_OTHER_SERVER_KEY
- See Also:
-
DELIMITER
- See Also:
-
COLOR_SPLITTER_REGEXP
- See Also:
-
COLOR_SPLITTER_REGEXP_COLON
- See Also:
-
CONFIGURABLE_RULE_SPLITTER_REGEXP
- See Also:
-
BLANK
- See Also:
-
BLANK_REPLACE
- See Also:
-
PROFILE_DELIMITER
- See Also:
-
configForOtherProfiles
-
configForOtherLanguages
-
errorColors
-
underlineColors
-
configurableRuleValues
-
styleLikeCategories
-
specialTabCategories
-
disabledRuleIds
-
enabledRuleIds
-
disabledCategoryNames
-
enabledCategoryNames
-
definedProfiles
-
allProfileKeys
-
allProfileLangKeys
-
lang
private org.languagetool.Language lang -
configFile
-
oldConfigFile
-
enabledRulesOnly
private boolean enabledRulesOnly -
language
private org.languagetool.Language language -
motherTongue
private org.languagetool.Language motherTongue -
ngramDirectory
-
word2vecDirectory
-
runServer
private boolean runServer -
autoDetect
private boolean autoDetect -
taggerShowsDisambigLog
private boolean taggerShowsDisambigLog -
guiConfig
private boolean guiConfig -
fontName
-
fontStyle
private int fontStyle -
fontSize
private int fontSize -
serverPort
private int serverPort -
numParasToCheck
private int numParasToCheck -
doResetCheck
private boolean doResetCheck -
noMultiReset
private boolean noMultiReset -
doFullCheckAtFirst
private boolean doFullCheckAtFirst -
externalRuleDirectory
-
lookAndFeelName
-
switchOff
private boolean switchOff -
useDocLanguage
private boolean useDocLanguage -
isMultiThreadLO
private boolean isMultiThreadLO -
currentProfile
-
doRemoteCheck
private boolean doRemoteCheck -
useOtherServer
private boolean useOtherServer -
otherServerUrl
-
-
Constructor Details
-
Configuration
Uses the configuration file from the default location.- Parameters:
lang- The language for the configuration, used to distinguish rules that are enabled or disabled per language.- Throws:
IOException
-
Configuration
- Throws:
IOException
-
Configuration
public Configuration(File baseDir, String filename, org.languagetool.Language lang) throws IOException - Throws:
IOException
-
Configuration
public Configuration(File baseDir, String filename, org.languagetool.Language lang, org.languagetool.LinguServices linguServices) throws IOException - Throws:
IOException
-
Configuration
public Configuration(File baseDir, String filename, File oldConfigFile, org.languagetool.Language lang, org.languagetool.LinguServices linguServices) throws IOException - Throws:
IOException
-
Configuration
private Configuration()
-
-
Method Details
-
initOptions
public void initOptions()Initialize variables and clears Maps, Sets and Lists -
copy
Returns a copy of the given configuration.- Parameters:
configuration- the object to copy.- Since:
- 2.6
-
restoreState
Restore the state of this object from configuration.- Parameters:
configuration- the object from which we will read the state- Since:
- 2.6
-
getDisabledRuleIds
-
getEnabledRuleIds
-
getDisabledCategoryNames
-
getEnabledCategoryNames
-
setDisabledRuleIds
-
addDisabledRuleIds
-
removeDisabledRuleIds
-
setEnabledRuleIds
-
setDisabledCategoryNames
-
setEnabledCategoryNames
-
getEnabledRulesOnly
public boolean getEnabledRulesOnly() -
getLanguage
public org.languagetool.Language getLanguage() -
setLanguage
public void setLanguage(org.languagetool.Language language) -
getMotherTongue
public org.languagetool.Language getMotherTongue() -
setMotherTongue
public void setMotherTongue(org.languagetool.Language motherTongue) -
getDefaultLanguage
public org.languagetool.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() -
setOtherServerUrl
-
getServerUrl
-
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
-
setExternalRuleDirectory
-
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
-
isNoMultiReset
public boolean isNoMultiReset()will all paragraphs not checked after every change of text if more than one document loaded?- Since:
- 4.5
-
setNoMultiReset
public void setNoMultiReset(boolean noMultiReset) set all paragraphs to be not checked after every change of text if more than one document loaded?- Since:
- 4.5
-
setFullCheckAtFirst
public void setFullCheckAtFirst(boolean doFullCheckAtFirst) set option to do a full check at first iteration- Since:
- 4.7
-
doFullCheckAtFirst
public boolean doFullCheckAtFirst()do a full check at first iteration?- Since:
- 4.7
-
getCurrentProfile
-
setCurrentProfile
-
getDefinedProfiles
-
addProfile
-
addProfiles
-
removeProfile
-
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
Returns the name of the GUI's editing textarea font.- Returns:
- the name of the font.
- Since:
- 2.6
- See Also:
-
setFontName
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
Returns the name of the GUI's LaF.- Returns:
- the name of the LaF.
- Since:
- 2.6
- See Also:
-
setLookAndFeelName
Sets the name of the GUI's LaF.- Parameters:
lookAndFeelName- the name of the LaF.- Since:
- 2.6 @see
- See Also:
-
getNgramDirectory
-
setNgramDirectory
Sets the directory with ngram data (may be null).- Since:
- 3.0
-
getWord2VecDirectory
Directory with word2vec data or null.- Since:
- 4.0
-
setWord2VecDirectory
Sets the directory with word2vec data (may be null).- Since:
- 4.0
-
getErrorColors
-
isStyleCategory
- Since:
- 4.3 Returns true if category is style like
-
initStyleCategories
- Since:
- 4.4 Initialize set of style like categories
-
isSpecialTabCategory
- Since:
- 4.3 Returns true if category is a special Tab category
-
isInSpecialTab
-
getSpecialTabNames
- Since:
- 4.3 Returns all special tab names
-
getSpecialTabCategories
-
getUnderlineColors
-
getUnderlineColor
-
setUnderlineColor
-
setDefaultUnderlineColor
- Since:
- 4.2 Set the color back to default (removes category from map)
-
getConfigurableValues
-
getConfigurableValue
- Since:
- 4.2 Get the configurable value of a rule by ruleID returns -1 if no value is set by configuration
-
setConfigurableValue
- Since:
- 4.2 Set the value for a rule with ruleID
-
isSwitchedOff
public boolean isSwitchedOff()- Since:
- 4.4 if true: LT is switched Off, else: LT is switched On
-
setSwitchedOff
- Throws:
IOException- Since:
- 4.4 Set LT is switched Off or On save configuration
-
loadConfiguration
- Throws:
IOException
-
loadConfiguration
- Throws:
IOException
-
parseErrorColors
-
parseUnderlineColors
-
parseConfigurableRuleValues
-
getQualifier
-
loadConfigForOtherLanguages
private void loadConfigForOtherLanguages(org.languagetool.Language lang, Properties prop, String prefix) -
storeConfigKeyFromProp
-
getListFromProperties
-
saveConfiguration
- Throws:
IOException
-
addListToProperties
-
setAllProfileKeys
private void setAllProfileKeys() -
storeConfigforAllProfiles
-
saveConfigforProfile
-