From 3292a50863fa8530599cf02c66ee544a6c2c681e Mon Sep 17 00:00:00 2001 From: kascade Date: Mon, 16 Jul 2007 11:38:03 +0000 Subject: [PATCH] updated logger workings git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@745 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d --- src/enginuity/logger/ecu/EcuLogger.java | 6 ++++++ src/enginuity/util/SettingsManager.java | 2 ++ src/enginuity/util/SettingsManagerImpl.java | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/enginuity/logger/ecu/EcuLogger.java b/src/enginuity/logger/ecu/EcuLogger.java index c0abe3d0..99f61033 100644 --- a/src/enginuity/logger/ecu/EcuLogger.java +++ b/src/enginuity/logger/ecu/EcuLogger.java @@ -70,6 +70,7 @@ import enginuity.logger.ecu.ui.swing.menubar.EcuLoggerMenuBar; import enginuity.logger.ecu.ui.swing.menubar.action.ToggleButtonAction; import static enginuity.util.ParamChecker.checkNotNull; import static enginuity.util.ParamChecker.isNullOrEmpty; +import enginuity.util.SettingsManagerImpl; import static enginuity.util.ThreadUtil.runAsDaemon; import static enginuity.util.ThreadUtil.sleep; import org.apache.log4j.Logger; @@ -847,9 +848,14 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC LOGGER.warn("Error stopping logger", e); } finally { rememberWindowProperties(); + saveSettings(); } } + private void saveSettings() { + new SettingsManagerImpl().save(settings); + } + private void rememberWindowProperties() { settings.setLoggerWindowMaximized(getExtendedState() == MAXIMIZED_BOTH); settings.setLoggerWindowSize(getSize()); diff --git a/src/enginuity/util/SettingsManager.java b/src/enginuity/util/SettingsManager.java index 0c3a88aa..0c3a543b 100644 --- a/src/enginuity/util/SettingsManager.java +++ b/src/enginuity/util/SettingsManager.java @@ -6,5 +6,7 @@ import enginuity.swing.JProgressPane; public interface SettingsManager { Settings load(String settingsNotFoundMessage); + void save(Settings settings); + void save(Settings settings, JProgressPane progress, String version); } diff --git a/src/enginuity/util/SettingsManagerImpl.java b/src/enginuity/util/SettingsManagerImpl.java index 538277a6..fde8c939 100644 --- a/src/enginuity/util/SettingsManagerImpl.java +++ b/src/enginuity/util/SettingsManagerImpl.java @@ -34,10 +34,13 @@ public final class SettingsManagerImpl implements SettingsManager { } } + public void save(Settings settings) { + save(settings, new JProgressPane(), ""); + } + public void save(Settings settings, JProgressPane progress, String version) { DOMSettingsBuilder builder = new DOMSettingsBuilder(); try { - //JProgressPane progress = new JProgressPane(this, "Saving settings...", "Saving settings..."); builder.buildSettings(settings, new File("./settings.xml"), progress, version); } catch (Exception e) { // ignore