diff --git a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/controller/startup/prepareView/CommandPrepareView.as b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/controller/startup/prepareView/CommandPrepareView.as index 24da4b4..e8a6cfd 100644 --- a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/controller/startup/prepareView/CommandPrepareView.as +++ b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/controller/startup/prepareView/CommandPrepareView.as @@ -17,7 +17,7 @@ package controller.startup.prepareView { override public function execute(note: INotification):void { - sendNotification(ApplicationConstants.COMMAND_SWITCH_THEME, Theme.DARK); + sendNotification(ApplicationConstants.COMMAND_SWITCH_THEME); var app:IApplication = note.getBody() as IApplication; diff --git a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/controller/startup/prepareView/CommandSwitchTheme.as b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/controller/startup/prepareView/CommandSwitchTheme.as index f69d09c..7b1f7ed 100644 --- a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/controller/startup/prepareView/CommandSwitchTheme.as +++ b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/controller/startup/prepareView/CommandSwitchTheme.as @@ -12,26 +12,32 @@ package controller.startup.prepareView { override public function execute(note:INotification):void { - var theme:String = String(note.getBody()); - var themeProxy:ProxyTheme = facade.retrieveProxy(ProxyTheme.NAME) as ProxyTheme; - - var themeId:* = document.getElementById(themeProxy.themeId); + var themeProxy:ProxyTheme = facade.retrieveProxy(ProxyTheme.NAME) as ProxyTheme; + var currentTheme:Object = themeProxy.getTheme(); + + var themeId:* = document.getElementById(currentTheme.themeId); if (themeId) { document.head.removeChild(themeId); } + + var theme:Object = note.getBody(); + if (!theme) + { + theme = currentTheme.theme; + } switch (theme) { case Theme.DARK: - themeProxy.themeId = loadCSS("resources/themes/" + Theme.DARK + "/defaults.css"); - themeProxy.theme = Theme.DARK; + themeId = loadCSS("resources/themes/" + Theme.DARK + "/defaults.css"); window["DevExpress"].ui.themes.current("generic." + Theme.DARK); + themeProxy.setTheme(Theme.DARK, themeId); break; default: - themeProxy.themeId = loadCSS("resources/themes/" + Theme.LIGHT + "/defaults.css"); - themeProxy.theme = Theme.LIGHT; + themeId = loadCSS("resources/themes/" + Theme.LIGHT + "/defaults.css"); window["DevExpress"].ui.themes.current("generic." + Theme.LIGHT); + themeProxy.setTheme(Theme.LIGHT, themeId); break; } } diff --git a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/mediator/MediatorMainContentView.as b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/mediator/MediatorMainContentView.as index bc46fa3..5acb8ed 100644 --- a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/mediator/MediatorMainContentView.as +++ b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/mediator/MediatorMainContentView.as @@ -388,8 +388,8 @@ package mediator private function onSwitchTheme(event:MouseEvent):void { var themeProxy:ProxyTheme = facade.retrieveProxy(ProxyTheme.NAME) as ProxyTheme; - var theme:String = themeProxy.theme; - sendNotification(ApplicationConstants.COMMAND_SWITCH_THEME, theme == Theme.DARK ? Theme.LIGHT : Theme.DARK); + var currentTheme:Object = themeProxy.getTheme(); + sendNotification(ApplicationConstants.COMMAND_SWITCH_THEME, currentTheme.theme == Theme.DARK ? Theme.LIGHT : Theme.DARK); } private function onNavigationSectionChange(event:Event):void diff --git a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/mediator/bookmarks/MediatorBrowseMyServer.as b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/mediator/bookmarks/MediatorBrowseMyServer.as index bcd0bb0..a477c69 100644 --- a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/mediator/bookmarks/MediatorBrowseMyServer.as +++ b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/mediator/bookmarks/MediatorBrowseMyServer.as @@ -47,8 +47,7 @@ package mediator.bookmarks this.view.copyToClipboardServer.addEventListener(MouseEvent.CLICK, onCopyToClipboardServer); this.view.copyToClipboardDatabase.addEventListener(MouseEvent.CLICK, onCopyToClipboardDatabase); this.view.copyToClipboardReplica.addEventListener(MouseEvent.CLICK, onCopyToClipboardReplica); - this.view.openNomadWeb.addEventListener(MouseEvent.CLICK, onOpenNomadWeb); - + this.refreshCurrentState(view.topMenu.selectedItem, view.topMenu.subSelectedItem); if (!this.browseMyServerProxy.getData()) { @@ -69,7 +68,6 @@ package mediator.bookmarks this.view.copyToClipboardServer.removeEventListener(MouseEvent.CLICK, onCopyToClipboardServer); this.view.copyToClipboardDatabase.removeEventListener(MouseEvent.CLICK, onCopyToClipboardDatabase); this.view.copyToClipboardReplica.removeEventListener(MouseEvent.CLICK, onCopyToClipboardReplica); - this.view.openNomadWeb.removeEventListener(MouseEvent.CLICK, onOpenNomadWeb); this.bookmarksProxy = null; this.browseMyServerProxy = null; diff --git a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/model/proxy/ProxyTheme.as b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/model/proxy/ProxyTheme.as index 0ebce48..023c3c1 100644 --- a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/model/proxy/ProxyTheme.as +++ b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/model/proxy/ProxyTheme.as @@ -1,6 +1,7 @@ package model.proxy { import org.puremvc.as3.multicore.patterns.proxy.Proxy; + import constants.Theme; public class ProxyTheme extends Proxy { @@ -9,33 +10,38 @@ package model.proxy public function ProxyTheme() { super(NAME); + + this.setData({theme: Theme.LIGHT}); } - - private var _themeId:String; - public function get themeId():String + public function getTheme():Object { - return _themeId; - } - - public function set themeId(value:String):void - { - if (_themeId != value) + var currentTheme:String = window["Cookies"].get("MyAccountTheme"); + var currentThemeId:String = window["Cookies"].get("MyAccountThemeId"); + + for (var t:String in Theme) { - _themeId = value; + if (Theme[t] == currentTheme) + { + return {theme: currentTheme, themeId: currentThemeId}; + } } + + return this.getData(); } - - public function get theme():String - { - return String(this.getData()); - } - - public function set theme(value:String):void + + public function setTheme(theme:String, themeId:String):void { - if (String(this.getData()) != value) + for (var t:String in Theme) { - this.setData(value); + if (Theme[t] == theme) + { + window["Cookies"].set("MyAccountTheme", theme); + window["Cookies"].set("MyAccountThemeId", themeId); + + this.setData({theme: theme, themeId: themeId}); + break; + } } } } diff --git a/Super.Human.Portal_Royale/src/resources/jewel-index-template.html b/Super.Human.Portal_Royale/src/resources/jewel-index-template.html index 1c119e6..adeb52f 100644 --- a/Super.Human.Portal_Royale/src/resources/jewel-index-template.html +++ b/Super.Human.Portal_Royale/src/resources/jewel-index-template.html @@ -31,7 +31,7 @@ - + ${head}