mirror of https://github.com/rusefi/RomRaider.git
Fixed BitwiseSwitch not closing. Added better error messages for logger definition
This commit is contained in:
parent
b500baf100
commit
c20afa585b
|
@ -16,6 +16,7 @@ COMPLETE = Complete ...
|
|||
READY = Ready ...
|
||||
YES = Yes
|
||||
NO = No
|
||||
LOGGERDEFERROR = Error loading definition:
|
||||
LOGGERDEFNOTCFG = Logger definition not configured.\nGo online to download the latest definition file?
|
||||
LOGGERCONFIG = Logger Configuration
|
||||
CFGEDFSMENU = The Logger definition file needs to be configured before connecting to the ECU.\nMenu: Settings > Logger Definition Location ...\nOnce configured, restart the Logger application.
|
||||
|
|
|
@ -593,7 +593,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
LOGGER.info(loadResult);
|
||||
} catch (ConfigurationException cfe) {
|
||||
reportError(cfe);
|
||||
showMissingConfigDialog();
|
||||
showErrorConfigDialog(cfe);
|
||||
}
|
||||
catch (Exception e) {
|
||||
reportError(e);
|
||||
|
@ -601,6 +601,18 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
}
|
||||
}
|
||||
|
||||
private void showErrorConfigDialog(Exception e) {
|
||||
Object[] options = {"OK"};
|
||||
showOptionDialog(this,
|
||||
rb.getString("LOGGERDEFERROR") + e.getMessage(),
|
||||
rb.getString("LOGGERCONFIG"),
|
||||
DEFAULT_OPTION,
|
||||
ERROR_MESSAGE,
|
||||
null,
|
||||
options,
|
||||
options[0]);
|
||||
}
|
||||
|
||||
private void showMissingConfigDialog() {
|
||||
Object[] options = {rb.getString("YES"), rb.getString("NO")};
|
||||
int answer = showOptionDialog(this,
|
||||
|
|
|
@ -136,7 +136,7 @@ public final class EcuDataLoaderImpl implements EcuDataLoader {
|
|||
} finally {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
}/* catch (FileNotFoundException fnfe) {
|
||||
throw new ConfigurationException(MessageFormat.format(
|
||||
rb.getString("LOGFNF"), loggerConfigFilePath));
|
||||
} catch (SAXParseException spe) {
|
||||
|
@ -144,7 +144,7 @@ public final class EcuDataLoaderImpl implements EcuDataLoader {
|
|||
// unzip the defs that a better error message is in order
|
||||
throw new ConfigurationException(MessageFormat.format(
|
||||
rb.getString("UNZIPLOG"), loggerConfigFilePath));
|
||||
} catch (Exception e) {
|
||||
} */catch (Exception e) {
|
||||
throw new ConfigurationException(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ public class DataCell {
|
|||
if (st.hasMoreTokens()) {
|
||||
this.staticText = st.nextToken();
|
||||
}
|
||||
table.setStaticDataTable(true);
|
||||
}
|
||||
|
||||
public DataCell(Table table, int index, Rom rom) {
|
||||
|
|
|
@ -104,6 +104,18 @@ public abstract class Table implements Serializable {
|
|||
return data;
|
||||
}
|
||||
|
||||
public void addStaticDataCell(String s) {
|
||||
setStaticDataTable(true);
|
||||
DataCell c = new DataCell(this, s, null);
|
||||
|
||||
for(int i = 0; i < data.length; i++) {
|
||||
if(data[i] == null) {
|
||||
data[i] = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Cleans up all references to avoid data leaks
|
||||
public void clearData() {
|
||||
|
||||
|
|
|
@ -56,17 +56,6 @@ public class Table1D extends Table {
|
|||
return binData;
|
||||
}
|
||||
|
||||
public void addStaticDataCell(String s) {
|
||||
DataCell c = new DataCell(this, s, null);
|
||||
|
||||
for(int i = 0; i < data.length; i++) {
|
||||
if(data[i] == null) {
|
||||
data[i] = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringBuffer getTableAsString() {
|
||||
if(isStaticDataTable()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||
* Copyright (C) 2006-2020 RomRaider.com
|
||||
* Copyright (C) 2006-2021 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
|
||||
|
@ -19,7 +19,6 @@
|
|||
|
||||
package com.romraider.maps;
|
||||
|
||||
import java.awt.GridLayout;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
@ -30,9 +29,6 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import com.romraider.util.ByteUtil;
|
||||
|
||||
public class TableBitwiseSwitch extends Table {
|
||||
|
@ -58,11 +54,13 @@ public class TableBitwiseSwitch extends Table {
|
|||
bits_array[((dataSize - 1 - i) *8)+ j] = byte_values[7-j];
|
||||
}
|
||||
}
|
||||
|
||||
JPanel radioPanel = new JPanel(new GridLayout(0, 1));
|
||||
radioPanel.add(new JLabel(" " + getName()));
|
||||
}
|
||||
|
||||
//Cleans up all references to avoid data leaks
|
||||
public void clearData() {
|
||||
controlBits.clear();
|
||||
}
|
||||
|
||||
public Map<String, Integer> getControlBits() {
|
||||
return controlBits;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||
* Copyright (C) 2006-2020 RomRaider.com
|
||||
* Copyright (C) 2006-2021 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
|
||||
|
@ -45,7 +45,6 @@ public class TableBitwiseSwitchView extends TableView {
|
|||
private ArrayList<JCheckBox> checkboxes;
|
||||
private TableBitwiseSwitch table;
|
||||
|
||||
|
||||
public TableBitwiseSwitchView(TableBitwiseSwitch table) {
|
||||
super(table);
|
||||
this.table = table;
|
||||
|
@ -56,8 +55,7 @@ public class TableBitwiseSwitchView extends TableView {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void populateTableVisual()
|
||||
throws ArrayIndexOutOfBoundsException, IndexOutOfBoundsException {
|
||||
public void populateTableVisual() {
|
||||
int maxBitPosition = ((table.getDataSize() * 8) - 1);
|
||||
JPanel radioPanel = new JPanel(new GridLayout(0, 1));
|
||||
radioPanel.add(new JLabel(" " + getName()));
|
||||
|
@ -65,7 +63,7 @@ public class TableBitwiseSwitchView extends TableView {
|
|||
for (Entry<String, Integer> entry : TableBitwiseSwitch.sortByValue(table.getControlBits()).entrySet()) {
|
||||
if (entry.getValue() > maxBitPosition) {
|
||||
String mismatch = MessageFormat.format(
|
||||
rb.getString("OUTOFRANGE"), super.getName());
|
||||
rb.getString("OUTOFRANGE"), table.getName());
|
||||
showMessageDialog(this, mismatch,
|
||||
rb.getString("DEFERROR"), ERROR_MESSAGE);
|
||||
break;
|
||||
|
|
|
@ -601,8 +601,6 @@ public abstract class TableView extends JPanel implements Serializable {
|
|||
return new Dimension(width, height);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void startHighlight(int x, int y) {
|
||||
this.highlightBeginY = y;
|
||||
this.highlightBeginX = x;
|
||||
|
@ -896,14 +894,16 @@ public abstract class TableView extends JPanel implements Serializable {
|
|||
|
||||
|
||||
public void updateTableLabel() {
|
||||
if(null == table.name || table.name.isEmpty()) {
|
||||
;// Do not update label.
|
||||
} else if(null == table.getCurrentScale () || "0x" == table.getCurrentScale().getUnit()) {
|
||||
// static or no scale exists.
|
||||
tableLabel.setText(getName());
|
||||
} else {
|
||||
tableLabel.setText(getName() + " (" + table.getCurrentScale().getUnit() + ")");
|
||||
}
|
||||
if(tableLabel != null) {
|
||||
if(null == table.name || table.name.isEmpty()) {
|
||||
;// Do not update label.
|
||||
} else if(null == table.getCurrentScale () || "0x" == table.getCurrentScale().getUnit()) {
|
||||
// static or no scale exists.
|
||||
tableLabel.setText(getName());
|
||||
} else {
|
||||
tableLabel.setText(getName() + " (" + table.getCurrentScale().getUnit() + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
Loading…
Reference in New Issue