summaryrefslogtreecommitdiffstats
path: root/logo/src/xlogo/AppSettings.java
diff options
context:
space:
mode:
authorMarko Živković <[email protected]>2015-02-26 23:35:42 +0000
committerMarko Živković <[email protected]>2015-02-26 23:35:42 +0000
commit1338ce5d3efdaca292a420bac59756311efc0a3c (patch)
treed84b760e71132b10398d39a5226ac4c809c093dc /logo/src/xlogo/AppSettings.java
parente5d505f0329e1ae048a1445c45b65cef8cd4e36b (diff)
Separeted selection for gui language and logo language
git-svn-id: https://svn.code.sf.net/p/xlogo4schools/svn/trunk@29 3b0d7934-f7ef-4143-9606-b51f2e2281fd
Diffstat (limited to 'logo/src/xlogo/AppSettings.java')
-rw-r--r--logo/src/xlogo/AppSettings.java30
1 files changed, 29 insertions, 1 deletions
diff --git a/logo/src/xlogo/AppSettings.java b/logo/src/xlogo/AppSettings.java
index 8a8d2da..aa1beba 100644
--- a/logo/src/xlogo/AppSettings.java
+++ b/logo/src/xlogo/AppSettings.java
@@ -11,6 +11,7 @@ import xlogo.storage.WSManager;
import xlogo.storage.global.GlobalConfig;
import xlogo.storage.global.GlobalConfig.GlobalProperty;
import xlogo.storage.workspace.Language;
+import xlogo.storage.workspace.LogoLanguage;
import xlogo.storage.workspace.SyntaxHighlightConfig;
import xlogo.storage.workspace.WorkspaceConfig;
import xlogo.storage.workspace.WorkspaceConfig.WorkspaceProperty;
@@ -39,6 +40,10 @@ public class AppSettings implements Observable<AppSettings.AppProperty>{
setLanguage(wc.getLanguage());
};
+ private PropertyChangeListener logoLanguageListener= () -> {
+ setLogoLanguage(wc.getLogoLanguage());
+ };
+
private PropertyChangeListener syntaxListener = () -> {
setSyntaxHighlightingStyles(wc.getSyntaxHighlightStyles());
};
@@ -67,6 +72,7 @@ public class AppSettings implements Observable<AppSettings.AppProperty>{
if (wc != null) {
wc.removePropertyChangeListener(WorkspaceProperty.LANGUAGE, languageListener);
+ wc.removePropertyChangeListener(WorkspaceProperty.LOGO_LANGUAGE, logoLanguageListener);
wc.removePropertyChangeListener(WorkspaceProperty.SYNTAX_HIGHLIGHTING, syntaxListener);
}
@@ -74,9 +80,11 @@ public class AppSettings implements Observable<AppSettings.AppProperty>{
if (wc != null) {
setLanguage(wc.getLanguage());
+ setLogoLanguage(wc.getLogoLanguage());
setSyntaxHighlightingStyles(wc.getSyntaxHighlightStyles());
wc.addPropertyChangeListener(WorkspaceProperty.LANGUAGE, languageListener);
+ wc.addPropertyChangeListener(WorkspaceProperty.LOGO_LANGUAGE, logoLanguageListener);
wc.addPropertyChangeListener(WorkspaceProperty.SYNTAX_HIGHLIGHTING, syntaxListener);
}
publisher.publishEvent(AppProperty.WORKSPACE);
@@ -104,6 +112,26 @@ public class AppSettings implements Observable<AppSettings.AppProperty>{
Logo.generateLanguage(language);
publisher.publishEvent(AppProperty.LANGUAGE);
}
+
+
+ /* * * * * * *
+ * LANGUAGE
+ * * * * * * */
+
+ private LogoLanguage logoLanguage = LogoLanguage.ENGLISH;
+
+ public LogoLanguage getLogoLanguage() {
+ return logoLanguage;
+ }
+
+ protected void setLogoLanguage(LogoLanguage language) {
+ if (language == this.logoLanguage)
+ return;
+ logger.trace("Change language from " + this.language + " to " + language);
+ this.logoLanguage = language;
+ Logo.generateLogoLanguage(language);
+ publisher.publishEvent(AppProperty.LOGO_LANGUAGE);
+ }
/**
* Translate the key into the current language.
@@ -157,7 +185,7 @@ public class AppSettings implements Observable<AppSettings.AppProperty>{
* * * * * * */
public enum AppProperty {
- LANGUAGE, SYNTAX_HIGHLIGHTING, FONT, WORKSPACE;
+ LANGUAGE, LOGO_LANGUAGE, SYNTAX_HIGHLIGHTING, FONT, WORKSPACE;
}
private transient final PropertyChangePublisher<AppProperty> publisher = new PropertyChangePublisher<>();