updated logger workings

git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@745 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
kascade 2007-07-16 11:38:03 +00:00
parent fd271af064
commit 3292a50863
3 changed files with 12 additions and 1 deletions

View File

@ -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());

View File

@ -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);
}

View File

@ -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