Package org.languagetool.gui
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 String
private boolean
private static final String
private static final String
private static final String
private static final String
private static final String
private File
private static final String
private static final String
private static final String
private String
(package private) static final int
(package private) static final int
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private boolean
private boolean
private boolean
private static final String
private static final String
private static final String
private boolean
private static final String
private static final String
private String
private static final String
(package private) static final int
private static final String
(package private) static final int
private static final String
private String
private int
private int
private boolean
private static final String
private boolean
private org.languagetool.Language
private org.languagetool.Language
private static final String
private static final String
private String
private static final String
private static final String
private org.languagetool.Language
private static final String
private File
private static final String
private boolean
private int
private File
private static final String
private String
private static final String
private static final String
private static final String
private boolean
private static final String
private static final String
private int
(package private) static final Color
private boolean
private static final String
private boolean
private static final String
private static final String
private static final String
private static final String
private boolean
private boolean
private static final String
private File
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Configuration
(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 TypeMethodDescriptionvoid
addDisabledRuleIds
(Set<String> ruleIds) private void
addListToProperties
(Properties props, String key, Set<String> list) void
addProfile
(String profile) add a new profilevoid
addProfiles
(List<String> profiles) add a list of profiles(package private) Configuration
copy
(Configuration configuration) Returns a copy of the given configuration.boolean
do a full check at first iteration?boolean
boolean
int
getConfigurableValue
(String ruleID) returns all configured valuesget the current profileorg.languagetool.Language
get the current profileboolean
Returns the name of the GUI's editing textarea font.int
Returns the size of the GUI's editing textarea font.int
Returns the style of the GUI's editing textarea font.org.languagetool.Language
private Collection
<? extends String> getListFromProperties
(Properties props, String key) Returns the name of the GUI's LaF.org.languagetool.Language
@Nullable File
Directory with ngram data or null.int
get the number of paragraphs to be checked for TextLevelRulesprivate String
getQualifier
(org.languagetool.Language lang) boolean
int
getSpecialTabCategories
(String tabName) String[]
boolean
Determines whether the tagger window will also print the disambiguation log.getUnderlineColor
(String category) boolean
boolean
@Nullable File
Directory with word2vec data or null.void
Initialize variables and clears Maps, Sets and Listsvoid
initStyleCategories
(List<org.languagetool.rules.Rule> allRules) boolean
isInSpecialTab
(String category, String tabName) boolean
shall LO run in multi thread modeboolean
will all paragraphs not checked after every change of text if more than one document loaded?boolean
will all paragraphs check after every change of text?boolean
isSpecialTabCategory
(String category) boolean
isStyleCategory
(String category) boolean
private void
loadConfigForOtherLanguages
(org.languagetool.Language lang, Properties prop, String prefix) private void
void
loadConfiguration
(String profile) private void
parseConfigurableRuleValues
(String rulesValueString) private void
parseErrorColors
(String colorsString) private void
parseUnderlineColors
(String colorsString) void
removeDisabledRuleIds
(Set<String> ruleIds) void
removeProfile
(String profile) remove an existing profile(package private) void
restoreState
(Configuration configuration) Restore the state of this object from configuration.private void
saveConfigforProfile
(Properties props, String prefix) void
saveConfiguration
(org.languagetool.Language lang) private void
void
setAutoDetect
(boolean autoDetect) void
setConfigurableValue
(String ruleID, int value) void
setCurrentProfile
(String profile) set the current profilevoid
setDefaultUnderlineColor
(String category) void
setDisabledCategoryNames
(Set<String> categoryNames) void
setDisabledRuleIds
(Set<String> ruleIds) void
setDoResetCheck
(boolean resetCheck) set all paragraphs to be checked after every change of textvoid
setEnabledCategoryNames
(Set<String> categoryNames) void
setEnabledRuleIds
(Set<String> ruleIds) void
void
setFontName
(String fontName) Sets the name of the GUI's editing textarea font.void
setFontSize
(int fontSize) Sets the size of the GUI's editing textarea font.void
setFontStyle
(int fontStyle) Sets the style of the GUI's editing textarea font.void
setFullCheckAtFirst
(boolean doFullCheckAtFirst) set option to do a full check at first iterationvoid
setLanguage
(org.languagetool.Language language) void
setLookAndFeelName
(String lookAndFeelName) Sets the name of the GUI's LaF.void
setMotherTongue
(org.languagetool.Language motherTongue) void
setMultiThreadLO
(boolean isMultiThread) run LO in multi thread modevoid
setNgramDirectory
(File dir) Sets the directory with ngram data (may be null).void
setNoMultiReset
(boolean noMultiReset) set all paragraphs to be not checked after every change of text if more than one document loaded?void
setNumParasToCheck
(int numParas) set the number of paragraphs to be checked for TextLevelRulesvoid
setOtherServerUrl
(String otherServerUrl) void
setRemoteCheck
(boolean doRemoteCheck) void
setRunServer
(boolean runServer) void
setServerPort
(int serverPort) void
setSwitchedOff
(boolean switchOff, org.languagetool.Language lang) void
setTaggerShowsDisambigLog
(boolean taggerShowsDisambigLog) Enables or disables the disambiguation log on the tagger window, depending on the value of the parameter taggerShowsDisambigLog.void
setUnderlineColor
(String category, Color col) void
setUseDocLanguage
(boolean useDocLang) void
setUseGUIConfig
(boolean useGUIConfig) void
setUseOtherServer
(boolean useOtherServer) void
setWord2VecDirectory
(File dir) Sets the directory with word2vec data (may be null).private void
private void
storeConfigKeyFromProp
(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
get the current profile- Since:
- 4.7
-
setCurrentProfile
set the current profile- Since:
- 4.7
-
getDefinedProfiles
get the current profile- Since:
- 4.7
-
addProfile
add a new profile- Since:
- 4.7
-
addProfiles
add a list of profiles- Since:
- 4.7
-
removeProfile
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
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
Directory with ngram data or null.- Since:
- 3.0
-
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
- Since:
- 2.8
-
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
- Since:
- 4.3 Returns true if category is member of named special Tab
-
getSpecialTabNames
- Since:
- 4.3 Returns all special tab names
-
getSpecialTabCategories
- Since:
- 4.3 Returns all categories for a named special tab
-
getUnderlineColors
- Since:
- 4.2
-
getUnderlineColor
- Since:
- 4.2 Get the color to underline a rule match by the Name of its category
-
setUnderlineColor
- Since:
- 4.2 Set the color to underline a rule match for its category
-
setDefaultUnderlineColor
- Since:
- 4.2 Set the color back to default (removes category from map)
-
getConfigurableValues
returns all configured values- Since:
- 4.2
-
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
-