|
From: <ste...@us...> - 2010-07-30 10:20:48
|
Revision: 1362
http://rails.svn.sourceforge.net/rails/?rev=1362&view=rev
Author: stefanfrey
Date: 2010-07-30 10:20:42 +0000 (Fri, 30 Jul 2010)
Log Message:
-----------
Fix some problems with config
Modified Paths:
--------------
trunk/18xx/LocalisedText.properties
trunk/18xx/rails/ui/swing/ConfigWindow.java
trunk/18xx/rails/util/Config.java
Modified: trunk/18xx/LocalisedText.properties
===================================================================
--- trunk/18xx/LocalisedText.properties 2010-07-29 23:33:24 UTC (rev 1361)
+++ trunk/18xx/LocalisedText.properties 2010-07-30 10:20:42 UTC (rev 1362)
@@ -67,6 +67,8 @@
COMPANY=Company
COMPANY_DETAILS=Company details
CONFIG=Configuration
+CONFIG_APPLY_MESSAGE=Current changes (will be) applied
+CONFIG_APPLY_TITLE=Apply confirmation
CONFIG_CURRENT_PROFILE=Active profile = {0} (based on = {1})
CONFIG_DEFAULT_TITLE=Default profile
CONFIG_DEFAULT_MESSAGE=Select a template for settings
Modified: trunk/18xx/rails/ui/swing/ConfigWindow.java
===================================================================
--- trunk/18xx/rails/ui/swing/ConfigWindow.java 2010-07-29 23:33:24 UTC (rev 1361)
+++ trunk/18xx/rails/ui/swing/ConfigWindow.java 2010-07-30 10:20:42 UTC (rev 1362)
@@ -248,9 +248,14 @@
// do nothing
}
public void focusLost(FocusEvent arg0) {
- int value = (Integer)spinner.getValue();
- Double adjValue = (double)value / spinnerMultiple;
- item.setNewValue(adjValue.toString());
+ Integer value = (Integer)spinner.getValue();
+ if (item.type == ConfigItem.ConfigType.PERCENT) {
+ Double adjValue = (double)value / spinnerMultiple;
+ item.setNewValue(adjValue.toString());
+ } else {
+ item.setNewValue(value.toString());
+ }
+
}
}
);
@@ -525,6 +530,8 @@
private void applyConfig() {
Config.updateProfile(); // transfer the configitem to the active profile
+ JOptionPane.showMessageDialog(ConfigWindow.this, LocalText.getText("CONFIG_APPLY_MESSAGE"),
+ LocalText.getText("CONFIG_APPLY_TITLE"), JOptionPane.INFORMATION_MESSAGE);
}
private void closeConfig() {
Modified: trunk/18xx/rails/util/Config.java
===================================================================
--- trunk/18xx/rails/util/Config.java 2010-07-29 23:33:24 UTC (rev 1361)
+++ trunk/18xx/rails/util/Config.java 2010-07-30 10:20:42 UTC (rev 1362)
@@ -134,7 +134,11 @@
public static void updateProfile() {
for (List<ConfigItem> items:configPanels.values()) {
for (ConfigItem item:items) {
- if (!item.hasNewValue() || item.getNewValue().equals(defaultProperties.get(item.name))) continue;
+ if (!item.hasNewValue()) continue;
+ if (item.getNewValue().equals(defaultProperties.get(item.name))) {
+ userProperties.remove(item.name);
+ continue;
+ }
userProperties.setProperty(item.name, item.getNewValue());
item.callInitMethod();
log.debug("Changed property name = " + item.name + " to value = " + item.getNewValue());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|