mirror of https://github.com/rusefi/RomRaider.git
Fix to allow Editor table overlay to function when using non-en_US
locale.
This commit is contained in:
parent
5a421cf6ff
commit
c03b5a03c6
|
@ -56,12 +56,13 @@ import com.romraider.Settings;
|
||||||
import com.romraider.editor.ecu.ECUEditorManager;
|
import com.romraider.editor.ecu.ECUEditorManager;
|
||||||
import com.romraider.swing.TableToolBar;
|
import com.romraider.swing.TableToolBar;
|
||||||
import com.romraider.util.JEPUtil;
|
import com.romraider.util.JEPUtil;
|
||||||
|
import com.romraider.util.NumberUtil;
|
||||||
import com.romraider.util.SettingsManager;
|
import com.romraider.util.SettingsManager;
|
||||||
import com.romraider.xml.RomAttributeParser;
|
import com.romraider.xml.RomAttributeParser;
|
||||||
|
|
||||||
public abstract class Table extends JPanel implements Serializable {
|
public abstract class Table extends JPanel implements Serializable {
|
||||||
private static final long serialVersionUID = 6559256489995552645L;
|
private static final long serialVersionUID = 6559256489995552645L;
|
||||||
private static final Logger LOGGER = Logger.getLogger(Table.class);
|
protected static final Logger LOGGER = Logger.getLogger(Table.class);
|
||||||
protected static int memModelEndian;
|
protected static int memModelEndian;
|
||||||
|
|
||||||
protected String name;
|
protected String name;
|
||||||
|
@ -1381,9 +1382,10 @@ public abstract class Table extends JPanel implements Serializable {
|
||||||
public void highlightLiveData(String liveVal) {
|
public void highlightLiveData(String liveVal) {
|
||||||
if (getOverlayLog()) {
|
if (getOverlayLog()) {
|
||||||
double liveValue = 0.0;
|
double liveValue = 0.0;
|
||||||
try{
|
try {
|
||||||
liveValue = Double.parseDouble(liveVal);
|
liveValue = NumberUtil.doubleValue(liveVal);
|
||||||
} catch(NumberFormatException nex) {
|
} catch (Exception ex) {
|
||||||
|
LOGGER.error("Table - live data highlight parsing error for value: " + liveVal);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
package com.romraider.maps;
|
package com.romraider.maps;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
|
||||||
import com.romraider.Settings;
|
import com.romraider.Settings;
|
||||||
|
import com.romraider.util.NumberUtil;
|
||||||
|
|
||||||
public class Table1D extends Table {
|
public class Table1D extends Table {
|
||||||
private static final long serialVersionUID = -8747180767803835631L;
|
private static final long serialVersionUID = -8747180767803835631L;
|
||||||
|
@ -257,9 +257,10 @@ public class Table1D extends Table {
|
||||||
public void highlightLiveData(String liveVal) {
|
public void highlightLiveData(String liveVal) {
|
||||||
if (getOverlayLog()) {
|
if (getOverlayLog()) {
|
||||||
double liveValue = 0.0;
|
double liveValue = 0.0;
|
||||||
try{
|
try {
|
||||||
liveValue = Double.parseDouble(liveVal);
|
liveValue = NumberUtil.doubleValue(liveVal);
|
||||||
} catch(NumberFormatException nex) {
|
} catch (Exception ex) {
|
||||||
|
LOGGER.error("Table1D - live data highlight parsing error for value: " + liveVal);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||||
|
* Copyright (C) 2006-2016 RomRaider.com
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.romraider.util;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides Number conversion utilities based on the default Locale.
|
||||||
|
*/
|
||||||
|
public final class NumberUtil {
|
||||||
|
private static final NumberFormat numFormat = NumberFormat.getInstance(Locale.getDefault());
|
||||||
|
|
||||||
|
private NumberUtil() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value of the specified number in the default locale as a double.
|
||||||
|
* @param str - string to be converted.
|
||||||
|
* @return the numeric value represented by this object after conversion
|
||||||
|
* to type double.
|
||||||
|
* @exception ParseException is thrown when parse errors are encountered.
|
||||||
|
*/
|
||||||
|
public static double doubleValue(String str) throws ParseException {
|
||||||
|
return numFormat.parse(str).doubleValue();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue