From 7291f0d5d4603da6df9a77bda94468d4907b8b2b Mon Sep 17 00:00:00 2001 From: kascade Date: Sat, 23 Dec 2006 23:08:13 +0000 Subject: [PATCH] started adding autoconnect and ecu init to logger git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@393 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d --- src/enginuity/ECUEditor.java | 20 +---- .../io/connection/EcuConnection.java | 2 +- .../io/connection/SerialConnectionImpl.java | 1 - .../io/port/SerialPortRefresher.java | 36 ++++++--- src/enginuity/io/protocol/Protocol.java | 2 + .../io/protocol/ProtocolFactory.java | 44 +++++++++++ src/enginuity/io/protocol/SSMProtocol.java | 5 ++ src/enginuity/logger/EcuLogger.java | 72 +++++++---------- .../comms/controller/LoggerController.java | 5 +- .../controller/LoggerControllerImpl.java | 40 +++------- .../comms/manager/QueryManagerImpl.java | 77 +++++++++++++++---- src/enginuity/logger/ui/ControllerButton.java | 22 ------ .../logger/ui/ControllerListener.java | 21 +++++ .../logger/ui/DataRegistrationBroker.java | 21 +++++ .../logger/ui/DataRegistrationBrokerImpl.java | 21 +++++ .../logger/ui/EcuDataComparator.java | 21 +++++ src/enginuity/logger/ui/EcuLoggerMenuBar.java | 38 +++++++++ src/enginuity/logger/ui/MessageListener.java | 21 +++++ .../logger/ui/SerialPortComboBox.java | 21 +++++ src/enginuity/logger/ui/StatusIndicator.java | 21 +++++ .../logger/ui/handler/DataUpdateHandler.java | 21 +++++ .../ui/handler/DataUpdateHandlerManager.java | 21 +++++ .../handler/DataUpdateHandlerManagerImpl.java | 21 +++++ .../DataUpdateHandlerThreadWrapper.java | 21 +++++ .../handler/dash/DashboardUpdateHandler.java | 21 +++++ .../logger/ui/handler/dash/Gauge.java | 21 +++++ .../logger/ui/handler/dash/PlainGauge.java | 21 +++++ .../logger/ui/handler/file/FileLogger.java | 21 +++++ .../ui/handler/file/FileLoggerImpl.java | 21 +++++ .../ui/handler/file/FileLoggerListener.java | 21 +++++ .../ui/handler/file/FileUpdateHandler.java | 21 +++++ .../ui/handler/graph/GraphUpdateHandler.java | 21 +++++ .../ui/handler/livedata/LiveDataRow.java | 21 +++++ .../handler/livedata/LiveDataTableModel.java | 21 +++++ .../livedata/LiveDataUpdateHandler.java | 21 +++++ .../ui/handler/table/TableUpdateHandler.java | 21 +++++ .../ui/paramlist/ParameterListTable.java | 21 +++++ .../ui/paramlist/ParameterListTableModel.java | 21 +++++ .../logger/ui/paramlist/ParameterRow.java | 21 +++++ .../ui/paramlist/UnitsComboBoxEditor.java | 21 +++++ .../ui/paramlist/UnitsComboBoxRenderer.java | 21 +++++ .../newmaps/definition/AttributeParser.java | 2 +- .../definition/RomDefinitionHandler.java | 31 +++++--- .../newmaps/definition/index/Index.java | 7 +- .../definition/index/IndexBuilder.java | 6 +- .../newmaps/definition/index/IndexItem.java | 3 +- .../newmaps/definition/index/IndexUtil.java | 9 +-- .../translate/DefinitionBuilder.java | 7 +- .../translate/FirstGenDefinitionHandler.java | 3 +- .../translate/FirstGenTranslator.java | 5 +- src/enginuity/newmaps/ecudata/Category.java | 1 + src/enginuity/newmaps/ecudata/ECUData.java | 1 + src/enginuity/newmaps/ecudata/Rom.java | 1 + src/enginuity/newmaps/ecudata/Scale.java | 1 + .../newmaps/ecudata/SourceDefAxis.java | 1 + src/enginuity/newmaps/ecudata/Switch.java | 3 +- .../newmaps/ecudata/SwitchGroup.java | 1 + src/enginuity/newmaps/ecudata/Unit.java | 1 + src/enginuity/newmaps/swing/Table.java | 3 +- src/enginuity/newmaps/swing/TableFrame.java | 7 +- src/enginuity/newmaps/xml/XmlHelper.java | 27 +++---- src/enginuity/swing/SettingsForm.java | 7 +- src/enginuity/util/MD5Checksum.java | 3 +- src/enginuity/util/NamedSet.java | 1 + src/enginuity/util/ObjectCloner.java | 2 - src/enginuity/util/ThreadUtil.java | 2 +- 66 files changed, 888 insertions(+), 199 deletions(-) create mode 100644 src/enginuity/io/protocol/ProtocolFactory.java delete mode 100644 src/enginuity/logger/ui/ControllerButton.java diff --git a/src/enginuity/ECUEditor.java b/src/enginuity/ECUEditor.java index 76cf58c9..706dd650 100644 --- a/src/enginuity/ECUEditor.java +++ b/src/enginuity/ECUEditor.java @@ -38,13 +38,12 @@ import enginuity.xml.DOMRomUnmarshaller; import enginuity.xml.DOMSettingsBuilder; import enginuity.xml.DOMSettingsUnmarshaller; import enginuity.xml.RomNotFoundException; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GridLayout; import org.w3c.dom.Document; import org.xml.sax.InputSource; + +import javax.swing.*; +import javax.swing.tree.TreePath; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowEvent; @@ -58,17 +57,6 @@ import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.util.Vector; -import javax.swing.ImageIcon; -import javax.swing.JCheckBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.JTextArea; -import javax.swing.UIManager; -import javax.swing.tree.TreePath; public class ECUEditor extends JFrame implements WindowListener, PropertyChangeListener { diff --git a/src/enginuity/io/connection/EcuConnection.java b/src/enginuity/io/connection/EcuConnection.java index 60f05232..b524cc00 100644 --- a/src/enginuity/io/connection/EcuConnection.java +++ b/src/enginuity/io/connection/EcuConnection.java @@ -26,5 +26,5 @@ public interface EcuConnection { byte[] send(byte[] bytes); void close(); - + } diff --git a/src/enginuity/io/connection/SerialConnectionImpl.java b/src/enginuity/io/connection/SerialConnectionImpl.java index c0c62f60..c1816e98 100644 --- a/src/enginuity/io/connection/SerialConnectionImpl.java +++ b/src/enginuity/io/connection/SerialConnectionImpl.java @@ -128,7 +128,6 @@ public final class SerialConnectionImpl implements SerialConnection { } } - private SerialPort connect(ConnectionProperties connectionProperties, String portName) { CommPortIdentifier portIdentifier = resolvePortIdentifier(portName); SerialPort serialPort = openPort(portIdentifier, connectionProperties.getConnectTimeout()); diff --git a/src/enginuity/io/port/SerialPortRefresher.java b/src/enginuity/io/port/SerialPortRefresher.java index f796791d..f66f136e 100644 --- a/src/enginuity/io/port/SerialPortRefresher.java +++ b/src/enginuity/io/port/SerialPortRefresher.java @@ -21,28 +21,40 @@ package enginuity.io.port; -import enginuity.logger.comms.controller.LoggerController; import static enginuity.util.ParamChecker.checkNotNull; +import enginuity.util.ThreadUtil; +import gnu.io.CommPortIdentifier; + +import java.util.List; +import java.util.Set; +import java.util.TreeSet; public final class SerialPortRefresher implements Runnable { + private static final long PORT_REFRESH_INTERVAL = 15000L; + private final SerialPortDiscoverer serialPortDiscoverer = new SerialPortDiscovererImpl(); private SerialPortRefreshListener listener; - private LoggerController controller; - public SerialPortRefresher(SerialPortRefreshListener listener, LoggerController controller) { - checkNotNull(listener, controller); + public SerialPortRefresher(SerialPortRefreshListener listener) { + checkNotNull(listener); this.listener = listener; - this.controller = controller; } public void run() { while (true) { - listener.refreshPortList(controller.listSerialPorts()); - try { - Thread.sleep(15000); - } catch (InterruptedException e) { - e.printStackTrace(); - break; - } + listener.refreshPortList(listSerialPorts()); + ThreadUtil.sleep(PORT_REFRESH_INTERVAL); } } + + private Set listSerialPorts() { + List portIdentifiers = serialPortDiscoverer.listPorts(); + Set portNames = new TreeSet(); + for (CommPortIdentifier portIdentifier : portIdentifiers) { + String portName = portIdentifier.getName(); + if (!portNames.contains(portName)) { + portNames.add(portName); + } + } + return portNames; + } } diff --git a/src/enginuity/io/protocol/Protocol.java b/src/enginuity/io/protocol/Protocol.java index 57241308..8631c1ab 100644 --- a/src/enginuity/io/protocol/Protocol.java +++ b/src/enginuity/io/protocol/Protocol.java @@ -33,6 +33,8 @@ public interface Protocol { byte calculateChecksum(byte[] bytes); + boolean isValidEcuInitResponse(byte[] bytes); + ConnectionProperties getConnectionProperties(); } diff --git a/src/enginuity/io/protocol/ProtocolFactory.java b/src/enginuity/io/protocol/ProtocolFactory.java new file mode 100644 index 00000000..47d95b09 --- /dev/null +++ b/src/enginuity/io/protocol/ProtocolFactory.java @@ -0,0 +1,44 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.io.protocol; + +import enginuity.logger.exception.UnsupportedProtocolException; + +public final class ProtocolFactory { + private static final ProtocolFactory INSTANCE = new ProtocolFactory(); + + public static ProtocolFactory getInstance() { + return INSTANCE; + } + + private ProtocolFactory() { + } + + public Protocol getProtocol(String protocolName) { + try { + Class cls = Class.forName(this.getClass().getPackage().getName() + "." + protocolName + "Protocol"); + return (Protocol) cls.newInstance(); + } catch (Exception e) { + throw new UnsupportedProtocolException("'" + protocolName + "' is not a supported protocol", e); + } + } +} diff --git a/src/enginuity/io/protocol/SSMProtocol.java b/src/enginuity/io/protocol/SSMProtocol.java index fdddad84..6bac2ffd 100644 --- a/src/enginuity/io/protocol/SSMProtocol.java +++ b/src/enginuity/io/protocol/SSMProtocol.java @@ -70,6 +70,11 @@ public final class SSMProtocol implements Protocol { return asByte(total - ((total >>> 16) << 16)); } + public boolean isValidEcuInitResponse(byte[] bytes) { + //TODO: Implement this!! + return bytes != null && bytes.length > 0; + } + public ConnectionProperties getConnectionProperties() { return new ConnectionProperties() { diff --git a/src/enginuity/logger/EcuLogger.java b/src/enginuity/logger/EcuLogger.java index 5aea832d..74d1bcff 100644 --- a/src/enginuity/logger/EcuLogger.java +++ b/src/enginuity/logger/EcuLogger.java @@ -25,6 +25,7 @@ import enginuity.Settings; import enginuity.io.port.SerialPortRefresher; import enginuity.logger.comms.controller.LoggerController; import enginuity.logger.comms.controller.LoggerControllerImpl; +import enginuity.logger.comms.query.LoggerCallback; import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuDataLoader; import enginuity.logger.definition.EcuDataLoaderImpl; @@ -36,7 +37,6 @@ import enginuity.logger.profile.UserProfileItem; import enginuity.logger.profile.UserProfileItemImpl; import enginuity.logger.profile.UserProfileLoader; import enginuity.logger.profile.UserProfileLoaderImpl; -import enginuity.logger.ui.ControllerButton; import enginuity.logger.ui.DataRegistrationBroker; import enginuity.logger.ui.DataRegistrationBrokerImpl; import enginuity.logger.ui.EcuDataComparator; @@ -57,11 +57,11 @@ import enginuity.logger.ui.handler.table.TableUpdateHandler; import enginuity.logger.ui.paramlist.ParameterListTable; import enginuity.logger.ui.paramlist.ParameterListTableModel; import enginuity.logger.ui.paramlist.ParameterRow; +import static enginuity.util.HexUtil.asHex; import static enginuity.util.ParamChecker.checkNotNull; +import enginuity.util.ThreadUtil; import javax.swing.*; -import static javax.swing.JOptionPane.ERROR_MESSAGE; -import static javax.swing.JOptionPane.showMessageDialog; import static javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED; import static javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER; import static javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED; @@ -90,11 +90,13 @@ import java.util.Map; /* TODO: add better debug logging, preferably to a file and switchable (on/off) -TODO: finish dashboard tab -TODO: add configuration screen (log file destination, etc) TODO: add user definable addresses TODO: Clean up this class! So much to do, so little time.... + +Autoconnect Stuff: +TODO: Add reconnect/refresh connection button/menu item. +TODO: Finish ecu init callback - parse it, etc */ public final class EcuLogger extends JFrame implements WindowListener, PropertyChangeListener, MessageListener { @@ -134,12 +136,21 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC initUserInterface(); initDataUpdateHandlers(); reloadUserProfile(settings.getLoggerProfileFilePath()); + restartLogging(); } private void bootstrap(Settings settings) { checkNotNull(settings); this.settings = settings; - controller = new LoggerControllerImpl(settings, this); + + // TODO: Do something useful with this!! + LoggerCallback ecuInitCallback = new LoggerCallback() { + public void callback(byte[] value) { + System.out.println("Ecu Init response = " + asHex(value)); + } + }; + + controller = new LoggerControllerImpl(settings, ecuInitCallback, this); statusBarLabel = new JLabel(ENGINUITY_ECU_LOGGER_TITLE); tabbedPane = new JTabbedPane(BOTTOM); portsComboBox = new SerialPortComboBox(settings); @@ -171,7 +182,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC } private void startPortRefresherThread() { - Thread portRefresherThread = new Thread(new SerialPortRefresher(portsComboBox, controller)); + Thread portRefresherThread = new Thread(new SerialPortRefresher(portsComboBox)); portRefresherThread.setDaemon(true); portRefresherThread.start(); } @@ -236,14 +247,12 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC } private void clearParamTableModels() { - stopLogging(); dataTabParamListTableModel.clear(); graphTabParamListTableModel.clear(); dashboardTabParamListTableModel.clear(); } private void clearSwitchTableModels() { - stopLogging(); dataTabSwitchListTableModel.clear(); graphTabSwitchListTableModel.clear(); dashboardTabSwitchListTableModel.clear(); @@ -395,7 +404,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC private JPanel buildControlToolbar() { JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 50, 0)); controlPanel.add(buildPortsComboBox()); - controlPanel.add(buildStartStopButtons()); + controlPanel.add(buildReconnectButton()); controlPanel.add(buildStatusIndicator()); return controlPanel; } @@ -404,7 +413,6 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC portsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { settings.setLoggerPort((String) portsComboBox.getSelectedItem()); - stopLogging(); } }); JPanel comboBoxPanel = new JPanel(new FlowLayout()); @@ -413,33 +421,19 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC return comboBoxPanel; } - private JPanel buildStartStopButtons() { - JPanel buttonPanel = new JPanel(new FlowLayout()); - buttonPanel.add(buildStartButton()); - buttonPanel.add(buildStopButton()); - return buttonPanel; - } - - private ControllerButton buildStartButton() { - ControllerButton startButton = new ControllerButton("Start", true); - startButton.addActionListener(new ActionListener() { + private JButton buildReconnectButton() { + JButton reconnectButton = new JButton("Reconnect"); + reconnectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { - startLogging(); + restartLogging(); } }); - controller.addListener(startButton); - return startButton; + return reconnectButton; } - private ControllerButton buildStopButton() { - ControllerButton stopButton = new ControllerButton("Stop", false); - stopButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent actionEvent) { - stopLogging(); - } - }); - controller.addListener(stopButton); - return stopButton; + public void restartLogging() { + stopLogging(); + startLogging(); } private StatusIndicator buildStatusIndicator() { @@ -486,10 +480,6 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC public void propertyChange(PropertyChangeEvent propertyChangeEvent) { } - public void loadProfile(File profileFile) { - //TODO: Finish profile loading from file!! - } - public void startLogging() { settings.setLoggerPort((String) portsComboBox.getSelectedItem()); controller.start(); @@ -497,17 +487,13 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC public void stopLogging() { controller.stop(); + ThreadUtil.sleep(1000L); } public void handleExit() { try { try { stopLogging(); - try { - Thread.sleep(250); - } catch (InterruptedException e) { - e.printStackTrace(); - } } finally { cleanUpUpdateHandlers(); } @@ -542,7 +528,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC public void reportError(String error) { if (error != null) { - showMessageDialog(null, error, "Alert", ERROR_MESSAGE); + statusBarLabel.setText("Error: " + error); } } diff --git a/src/enginuity/logger/comms/controller/LoggerController.java b/src/enginuity/logger/comms/controller/LoggerController.java index f2d01108..8aa5a5da 100644 --- a/src/enginuity/logger/comms/controller/LoggerController.java +++ b/src/enginuity/logger/comms/controller/LoggerController.java @@ -25,12 +25,8 @@ import enginuity.logger.comms.query.LoggerCallback; import enginuity.logger.definition.EcuData; import enginuity.logger.ui.ControllerListener; -import java.util.Set; - public interface LoggerController { - Set listSerialPorts(); - void addLogger(String callerId, EcuData ecuData, LoggerCallback callback); void removeLogger(String callerId, EcuData ecuData); @@ -40,4 +36,5 @@ public interface LoggerController { void stop(); void addListener(ControllerListener listener); + } diff --git a/src/enginuity/logger/comms/controller/LoggerControllerImpl.java b/src/enginuity/logger/comms/controller/LoggerControllerImpl.java index 37b97a20..5eec44a8 100644 --- a/src/enginuity/logger/comms/controller/LoggerControllerImpl.java +++ b/src/enginuity/logger/comms/controller/LoggerControllerImpl.java @@ -22,46 +22,26 @@ package enginuity.logger.comms.controller; import enginuity.Settings; -import enginuity.io.port.SerialPortDiscoverer; -import enginuity.io.port.SerialPortDiscovererImpl; import enginuity.logger.comms.manager.QueryManager; import enginuity.logger.comms.manager.QueryManagerImpl; -import enginuity.logger.comms.manager.TransmissionManager; -import enginuity.logger.comms.manager.TransmissionManagerImpl; import enginuity.logger.comms.query.LoggerCallback; import enginuity.logger.definition.EcuData; import enginuity.logger.ui.ControllerListener; import enginuity.logger.ui.MessageListener; import static enginuity.util.ParamChecker.checkNotNull; -import gnu.io.CommPortIdentifier; import java.util.ArrayList; -import java.util.Collections; +import static java.util.Collections.synchronizedList; import java.util.List; -import java.util.Set; -import java.util.TreeSet; public final class LoggerControllerImpl implements LoggerController { private final QueryManager queryManager; - private final List listeners = Collections.synchronizedList(new ArrayList()); + private final List listeners = synchronizedList(new ArrayList()); private boolean started = false; - public LoggerControllerImpl(Settings settings, MessageListener messageListener) { - TransmissionManager txManager = new TransmissionManagerImpl(settings); - queryManager = new QueryManagerImpl(this, txManager, messageListener); - } - - public Set listSerialPorts() { - SerialPortDiscoverer serialPortDiscoverer = new SerialPortDiscovererImpl(); - List portIdentifiers = serialPortDiscoverer.listPorts(); - Set portNames = new TreeSet(); - for (CommPortIdentifier portIdentifier : portIdentifiers) { - String portName = portIdentifier.getName(); - if (!portNames.contains(portName)) { - portNames.add(portName); - } - } - return portNames; + public LoggerControllerImpl(Settings settings, LoggerCallback ecuInitCallback, MessageListener messageListener) { + checkNotNull(settings, ecuInitCallback, messageListener); + queryManager = new QueryManagerImpl(this, settings, ecuInitCallback, messageListener); } public synchronized void addListener(ControllerListener listener) { @@ -86,15 +66,17 @@ public final class LoggerControllerImpl implements LoggerController { Thread queryManagerThread = new Thread(queryManager); queryManagerThread.setDaemon(true); queryManagerThread.start(); - startListeners(); started = true; + startListeners(); } } public synchronized void stop() { - stopListeners(); - queryManager.stop(); - started = false; + if (started) { + queryManager.stop(); + started = false; + stopListeners(); + } } private void startListeners() { diff --git a/src/enginuity/logger/comms/manager/QueryManagerImpl.java b/src/enginuity/logger/comms/manager/QueryManagerImpl.java index 8449566c..7940cc0c 100644 --- a/src/enginuity/logger/comms/manager/QueryManagerImpl.java +++ b/src/enginuity/logger/comms/manager/QueryManagerImpl.java @@ -21,6 +21,11 @@ package enginuity.logger.comms.manager; +import enginuity.Settings; +import enginuity.io.connection.EcuConnection; +import enginuity.io.connection.EcuConnectionImpl; +import enginuity.io.protocol.Protocol; +import enginuity.io.protocol.ProtocolFactory; import enginuity.logger.comms.controller.LoggerController; import enginuity.logger.comms.query.LoggerCallback; import enginuity.logger.comms.query.RegisteredQuery; @@ -28,6 +33,7 @@ import enginuity.logger.comms.query.RegisteredQueryImpl; import enginuity.logger.definition.EcuData; import enginuity.logger.ui.MessageListener; import static enginuity.util.ParamChecker.checkNotNull; +import enginuity.util.ThreadUtil; import java.text.DecimalFormat; import java.util.ArrayList; @@ -36,47 +42,89 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@SuppressWarnings({"FieldCanBeLocal"}) public final class QueryManagerImpl implements QueryManager { private final DecimalFormat format = new DecimalFormat("0.00"); private final Map queryMap = Collections.synchronizedMap(new HashMap()); private final Map addList = new HashMap(); private final List removeList = new ArrayList(); - private final TransmissionManager txManager; - private final MessageListener messageListener; private final LoggerController controller; + private final Settings settings; + private final LoggerCallback ecuInitCallback; + private final MessageListener messageListener; private boolean stop = false; + private Thread queryManagerThread = null; - public QueryManagerImpl(LoggerController controller, TransmissionManager txManager, MessageListener messageListener) { - checkNotNull(controller, txManager, messageListener); + public QueryManagerImpl(LoggerController controller, Settings settings, LoggerCallback ecuInitCallback, MessageListener messageListener) { + checkNotNull(controller, settings, ecuInitCallback, messageListener); this.controller = controller; - this.txManager = txManager; + this.settings = settings; + this.ecuInitCallback = ecuInitCallback; this.messageListener = messageListener; } public synchronized void addQuery(String callerId, EcuData ecuData, LoggerCallback callback) { - checkNotNull(ecuData, callback); + checkNotNull(callerId, ecuData, callback); addList.put(buildQueryId(callerId, ecuData), new RegisteredQueryImpl(ecuData, callback)); } public synchronized void removeQuery(String callerId, EcuData ecuData) { + checkNotNull(callerId, ecuData); removeList.add(buildQueryId(callerId, ecuData)); } public void run() { + queryManagerThread = Thread.currentThread(); System.out.println("QueryManager started."); + stop = false; + while (!stop) { + if (doEcuInit()) { + runLogger(); + } else { + ThreadUtil.sleep(5000L); + } + } + System.out.println("QueryManager stopped."); + } + private boolean doEcuInit() { + Protocol protocol = ProtocolFactory.getInstance().getProtocol(settings.getLoggerProtocol()); + EcuConnection ecuConnection = new EcuConnectionImpl(protocol.getConnectionProperties(), settings.getLoggerPort()); + try { + messageListener.reportMessage("Sending ECU Init..."); + byte[] response = ecuConnection.send(protocol.constructEcuInitRequest()); + if (protocol.isValidEcuInitResponse(response)) { + ecuInitCallback.callback(response); + messageListener.reportMessage("Sending ECU Init...done."); + return true; + } else { + messageListener.reportMessage("Waiting for ECU connection..."); + return false; + } + } catch (Exception e) { + messageListener.reportMessage("Error sending ECU init - check correct serial port has been selected."); + e.printStackTrace(); + return false; + } finally { + ecuConnection.close(); + } + } + + private void runLogger() { + TransmissionManager txManager = new TransmissionManagerImpl(settings); long start = System.currentTimeMillis(); int count = 0; - try { txManager.start(); - stop = false; while (!stop) { updateQueryList(); - txManager.sendQueries(queryMap.values()); - count++; - messageListener.reportMessage(buildStatsMessage(start, count)); + if (queryMap.isEmpty()) { + messageListener.reportMessage("Select parameters to be logged..."); + ThreadUtil.sleep(2000L); + } else { + txManager.sendQueries(queryMap.values()); + count++; + messageListener.reportMessage(buildStatsMessage(start, count)); + } } } catch (Exception e) { e.printStackTrace(); @@ -84,13 +132,14 @@ public final class QueryManagerImpl implements QueryManager { messageListener.reportError(e); } finally { txManager.stop(); - messageListener.reportMessage("Logging stopped."); } - System.out.println("QueryManager stopped."); } public void stop() { stop = true; + if (queryManagerThread != null) { + queryManagerThread.interrupt(); + } } private String buildQueryId(String callerId, EcuData ecuData) { diff --git a/src/enginuity/logger/ui/ControllerButton.java b/src/enginuity/logger/ui/ControllerButton.java deleted file mode 100644 index 57b60ea2..00000000 --- a/src/enginuity/logger/ui/ControllerButton.java +++ /dev/null @@ -1,22 +0,0 @@ -package enginuity.logger.ui; - -import javax.swing.*; - -public final class ControllerButton extends JButton implements ControllerListener { - private final boolean enabledOnInit; - - public ControllerButton(String string, boolean enabledOnInit) { - super(string); - this.enabledOnInit = enabledOnInit; - setEnabled(enabledOnInit); - } - - public void start() { - setEnabled(!enabledOnInit); - } - - public void stop() { - setEnabled(enabledOnInit); - } - -} diff --git a/src/enginuity/logger/ui/ControllerListener.java b/src/enginuity/logger/ui/ControllerListener.java index 20c3bcb1..5874494c 100644 --- a/src/enginuity/logger/ui/ControllerListener.java +++ b/src/enginuity/logger/ui/ControllerListener.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui; public interface ControllerListener { diff --git a/src/enginuity/logger/ui/DataRegistrationBroker.java b/src/enginuity/logger/ui/DataRegistrationBroker.java index 6dd5236c..9926299f 100644 --- a/src/enginuity/logger/ui/DataRegistrationBroker.java +++ b/src/enginuity/logger/ui/DataRegistrationBroker.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/ui/DataRegistrationBrokerImpl.java b/src/enginuity/logger/ui/DataRegistrationBrokerImpl.java index 338de133..ac92a0ce 100644 --- a/src/enginuity/logger/ui/DataRegistrationBrokerImpl.java +++ b/src/enginuity/logger/ui/DataRegistrationBrokerImpl.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui; import enginuity.logger.comms.controller.LoggerController; diff --git a/src/enginuity/logger/ui/EcuDataComparator.java b/src/enginuity/logger/ui/EcuDataComparator.java index 1f2afee0..07ee8aff 100644 --- a/src/enginuity/logger/ui/EcuDataComparator.java +++ b/src/enginuity/logger/ui/EcuDataComparator.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/ui/EcuLoggerMenuBar.java b/src/enginuity/logger/ui/EcuLoggerMenuBar.java index 803d0310..272ff82a 100644 --- a/src/enginuity/logger/ui/EcuLoggerMenuBar.java +++ b/src/enginuity/logger/ui/EcuLoggerMenuBar.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui; import enginuity.logger.EcuLogger; @@ -26,6 +47,9 @@ public class EcuLoggerMenuBar extends JMenuBar implements ActionListener { private JMenuItem profileManager = new JMenuItem("Profile Manager"); private JMenuItem logFileLocation = new JMenuItem("Log File Output Location..."); + private JMenu connectionMenu = new JMenu("Connection"); + private JMenuItem reconnect = new JMenuItem("Reconnect..."); + private JMenu helpMenu = new JMenu("Help"); private JMenuItem about = new JMenuItem("About Enginuity ECU Logger"); @@ -62,6 +86,13 @@ public class EcuLoggerMenuBar extends JMenuBar implements ActionListener { profileManager.addActionListener(this); logFileLocation.addActionListener(this); + // connection menu items + add(connectionMenu); + connectionMenu.setMnemonic('C'); + reconnect.setMnemonic('R'); + connectionMenu.add(reconnect); + reconnect.addActionListener(this); + // help menu stuff add(helpMenu); helpMenu.setMnemonic('H'); @@ -118,6 +149,13 @@ public class EcuLoggerMenuBar extends JMenuBar implements ActionListener { parent.reportError(e); } + } else if (evt.getSource() == reconnect) { + try { + parent.restartLogging(); + } catch (Exception e) { + parent.reportError(e); + } + } } diff --git a/src/enginuity/logger/ui/MessageListener.java b/src/enginuity/logger/ui/MessageListener.java index a7de1fc5..b04a3369 100644 --- a/src/enginuity/logger/ui/MessageListener.java +++ b/src/enginuity/logger/ui/MessageListener.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui; public interface MessageListener { diff --git a/src/enginuity/logger/ui/SerialPortComboBox.java b/src/enginuity/logger/ui/SerialPortComboBox.java index ea9ee3be..a49f0b08 100644 --- a/src/enginuity/logger/ui/SerialPortComboBox.java +++ b/src/enginuity/logger/ui/SerialPortComboBox.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui; import enginuity.Settings; diff --git a/src/enginuity/logger/ui/StatusIndicator.java b/src/enginuity/logger/ui/StatusIndicator.java index 604ca869..4536ac3d 100644 --- a/src/enginuity/logger/ui/StatusIndicator.java +++ b/src/enginuity/logger/ui/StatusIndicator.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui; import enginuity.logger.ui.handler.file.FileLoggerListener; diff --git a/src/enginuity/logger/ui/handler/DataUpdateHandler.java b/src/enginuity/logger/ui/handler/DataUpdateHandler.java index 0702add6..b9aa361d 100644 --- a/src/enginuity/logger/ui/handler/DataUpdateHandler.java +++ b/src/enginuity/logger/ui/handler/DataUpdateHandler.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/ui/handler/DataUpdateHandlerManager.java b/src/enginuity/logger/ui/handler/DataUpdateHandlerManager.java index e76d908a..b53ee62d 100644 --- a/src/enginuity/logger/ui/handler/DataUpdateHandlerManager.java +++ b/src/enginuity/logger/ui/handler/DataUpdateHandlerManager.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler; public interface DataUpdateHandlerManager extends DataUpdateHandler { diff --git a/src/enginuity/logger/ui/handler/DataUpdateHandlerManagerImpl.java b/src/enginuity/logger/ui/handler/DataUpdateHandlerManagerImpl.java index 2632e6c7..2f0a0e44 100644 --- a/src/enginuity/logger/ui/handler/DataUpdateHandlerManagerImpl.java +++ b/src/enginuity/logger/ui/handler/DataUpdateHandlerManagerImpl.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/ui/handler/DataUpdateHandlerThreadWrapper.java b/src/enginuity/logger/ui/handler/DataUpdateHandlerThreadWrapper.java index 5f9855f2..22d3e81b 100644 --- a/src/enginuity/logger/ui/handler/DataUpdateHandlerThreadWrapper.java +++ b/src/enginuity/logger/ui/handler/DataUpdateHandlerThreadWrapper.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/ui/handler/dash/DashboardUpdateHandler.java b/src/enginuity/logger/ui/handler/dash/DashboardUpdateHandler.java index 435fc458..7e3104ac 100644 --- a/src/enginuity/logger/ui/handler/dash/DashboardUpdateHandler.java +++ b/src/enginuity/logger/ui/handler/dash/DashboardUpdateHandler.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler.dash; import enginuity.logger.definition.ConvertorUpdateListener; diff --git a/src/enginuity/logger/ui/handler/dash/Gauge.java b/src/enginuity/logger/ui/handler/dash/Gauge.java index 2060e7b4..402481b3 100644 --- a/src/enginuity/logger/ui/handler/dash/Gauge.java +++ b/src/enginuity/logger/ui/handler/dash/Gauge.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler.dash; import javax.swing.*; diff --git a/src/enginuity/logger/ui/handler/dash/PlainGauge.java b/src/enginuity/logger/ui/handler/dash/PlainGauge.java index d26a2ba3..20331f36 100644 --- a/src/enginuity/logger/ui/handler/dash/PlainGauge.java +++ b/src/enginuity/logger/ui/handler/dash/PlainGauge.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler.dash; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/ui/handler/file/FileLogger.java b/src/enginuity/logger/ui/handler/file/FileLogger.java index 528a766a..840e3239 100644 --- a/src/enginuity/logger/ui/handler/file/FileLogger.java +++ b/src/enginuity/logger/ui/handler/file/FileLogger.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler.file; public interface FileLogger { diff --git a/src/enginuity/logger/ui/handler/file/FileLoggerImpl.java b/src/enginuity/logger/ui/handler/file/FileLoggerImpl.java index c0bbef2b..71dd96d1 100644 --- a/src/enginuity/logger/ui/handler/file/FileLoggerImpl.java +++ b/src/enginuity/logger/ui/handler/file/FileLoggerImpl.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler.file; import enginuity.Settings; diff --git a/src/enginuity/logger/ui/handler/file/FileLoggerListener.java b/src/enginuity/logger/ui/handler/file/FileLoggerListener.java index 6c928409..2250ead5 100644 --- a/src/enginuity/logger/ui/handler/file/FileLoggerListener.java +++ b/src/enginuity/logger/ui/handler/file/FileLoggerListener.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler.file; public interface FileLoggerListener { diff --git a/src/enginuity/logger/ui/handler/file/FileUpdateHandler.java b/src/enginuity/logger/ui/handler/file/FileUpdateHandler.java index 43b2b814..b8ac07ef 100644 --- a/src/enginuity/logger/ui/handler/file/FileUpdateHandler.java +++ b/src/enginuity/logger/ui/handler/file/FileUpdateHandler.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler.file; import enginuity.Settings; diff --git a/src/enginuity/logger/ui/handler/graph/GraphUpdateHandler.java b/src/enginuity/logger/ui/handler/graph/GraphUpdateHandler.java index e3a77107..5d837689 100644 --- a/src/enginuity/logger/ui/handler/graph/GraphUpdateHandler.java +++ b/src/enginuity/logger/ui/handler/graph/GraphUpdateHandler.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler.graph; import enginuity.logger.definition.ConvertorUpdateListener; diff --git a/src/enginuity/logger/ui/handler/livedata/LiveDataRow.java b/src/enginuity/logger/ui/handler/livedata/LiveDataRow.java index c1a27573..e099d1a6 100644 --- a/src/enginuity/logger/ui/handler/livedata/LiveDataRow.java +++ b/src/enginuity/logger/ui/handler/livedata/LiveDataRow.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler.livedata; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/ui/handler/livedata/LiveDataTableModel.java b/src/enginuity/logger/ui/handler/livedata/LiveDataTableModel.java index 854c79ae..e88497bd 100644 --- a/src/enginuity/logger/ui/handler/livedata/LiveDataTableModel.java +++ b/src/enginuity/logger/ui/handler/livedata/LiveDataTableModel.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler.livedata; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/ui/handler/livedata/LiveDataUpdateHandler.java b/src/enginuity/logger/ui/handler/livedata/LiveDataUpdateHandler.java index 1b6fd66c..28a564d7 100644 --- a/src/enginuity/logger/ui/handler/livedata/LiveDataUpdateHandler.java +++ b/src/enginuity/logger/ui/handler/livedata/LiveDataUpdateHandler.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler.livedata; import enginuity.logger.definition.ConvertorUpdateListener; diff --git a/src/enginuity/logger/ui/handler/table/TableUpdateHandler.java b/src/enginuity/logger/ui/handler/table/TableUpdateHandler.java index 065f0861..20cd41b9 100644 --- a/src/enginuity/logger/ui/handler/table/TableUpdateHandler.java +++ b/src/enginuity/logger/ui/handler/table/TableUpdateHandler.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.handler.table; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/ui/paramlist/ParameterListTable.java b/src/enginuity/logger/ui/paramlist/ParameterListTable.java index 63507584..8fdfe267 100644 --- a/src/enginuity/logger/ui/paramlist/ParameterListTable.java +++ b/src/enginuity/logger/ui/paramlist/ParameterListTable.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.paramlist; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/ui/paramlist/ParameterListTableModel.java b/src/enginuity/logger/ui/paramlist/ParameterListTableModel.java index 8ef40b58..ccc7ed61 100644 --- a/src/enginuity/logger/ui/paramlist/ParameterListTableModel.java +++ b/src/enginuity/logger/ui/paramlist/ParameterListTableModel.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.paramlist; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/ui/paramlist/ParameterRow.java b/src/enginuity/logger/ui/paramlist/ParameterRow.java index 01d6e84e..7bd470ee 100644 --- a/src/enginuity/logger/ui/paramlist/ParameterRow.java +++ b/src/enginuity/logger/ui/paramlist/ParameterRow.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.paramlist; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/ui/paramlist/UnitsComboBoxEditor.java b/src/enginuity/logger/ui/paramlist/UnitsComboBoxEditor.java index de080377..8faa1eb8 100644 --- a/src/enginuity/logger/ui/paramlist/UnitsComboBoxEditor.java +++ b/src/enginuity/logger/ui/paramlist/UnitsComboBoxEditor.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.paramlist; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/ui/paramlist/UnitsComboBoxRenderer.java b/src/enginuity/logger/ui/paramlist/UnitsComboBoxRenderer.java index cb1f504b..6d9bcba6 100644 --- a/src/enginuity/logger/ui/paramlist/UnitsComboBoxRenderer.java +++ b/src/enginuity/logger/ui/paramlist/UnitsComboBoxRenderer.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * 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 enginuity.logger.ui.paramlist; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/newmaps/definition/AttributeParser.java b/src/enginuity/newmaps/definition/AttributeParser.java index 7a56ecf4..37b938c4 100644 --- a/src/enginuity/newmaps/definition/AttributeParser.java +++ b/src/enginuity/newmaps/definition/AttributeParser.java @@ -23,7 +23,7 @@ package enginuity.newmaps.definition; import enginuity.newmaps.ecudata.Scale; import enginuity.newmaps.ecudata.Unit; -import java.util.Iterator; + import java.util.StringTokenizer; import java.util.Vector; diff --git a/src/enginuity/newmaps/definition/RomDefinitionHandler.java b/src/enginuity/newmaps/definition/RomDefinitionHandler.java index a2501405..dccaced7 100644 --- a/src/enginuity/newmaps/definition/RomDefinitionHandler.java +++ b/src/enginuity/newmaps/definition/RomDefinitionHandler.java @@ -21,23 +21,36 @@ package enginuity.newmaps.definition; -import static java.lang.Boolean.parseBoolean; -import static java.lang.Float.parseFloat; -import static enginuity.util.HexUtil.hexToInt; -import static java.lang.Integer.parseInt; -import static enginuity.newmaps.definition.AttributeParser.*; - +import static enginuity.newmaps.definition.AttributeParser.parseEndian; +import static enginuity.newmaps.definition.AttributeParser.parseStorageType; +import static enginuity.newmaps.definition.AttributeParser.parseUnitSystem; import enginuity.newmaps.definition.index.Index; -import enginuity.newmaps.ecudata.*; -import enginuity.util.NamedSet; import enginuity.newmaps.definition.index.IndexItem; +import enginuity.newmaps.ecudata.Axis; +import enginuity.newmaps.ecudata.Category; +import enginuity.newmaps.ecudata.ECUData; +import enginuity.newmaps.ecudata.Parameter; +import enginuity.newmaps.ecudata.Rom; +import enginuity.newmaps.ecudata.Scale; +import enginuity.newmaps.ecudata.SourceDefAxis; +import enginuity.newmaps.ecudata.Switch; +import enginuity.newmaps.ecudata.SwitchGroup; +import enginuity.newmaps.ecudata.Table2D; +import enginuity.newmaps.ecudata.Table3D; +import enginuity.newmaps.ecudata.Unit; import enginuity.newmaps.xml.SaxParserFactory; +import static enginuity.util.HexUtil.hexToInt; +import enginuity.util.NamedSet; +import enginuity.util.exception.NameableNotFoundException; import org.xml.sax.Attributes; import org.xml.sax.helpers.DefaultHandler; -import enginuity.util.exception.NameableNotFoundException; + import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.InputStream; +import static java.lang.Boolean.parseBoolean; +import static java.lang.Float.parseFloat; +import static java.lang.Integer.parseInt; import java.util.Stack; public class RomDefinitionHandler extends DefaultHandler { diff --git a/src/enginuity/newmaps/definition/index/Index.java b/src/enginuity/newmaps/definition/index/Index.java index db042b86..ed69dd54 100644 --- a/src/enginuity/newmaps/definition/index/Index.java +++ b/src/enginuity/newmaps/definition/index/Index.java @@ -21,13 +21,14 @@ package enginuity.newmaps.definition.index; -import enginuity.util.NamedSet; -import java.io.Serializable; -import java.util.Iterator; import static enginuity.util.MD5Checksum.getMD5Checksum; import enginuity.util.Nameable; +import enginuity.util.NamedSet; import enginuity.util.exception.NameableNotFoundException; + import java.io.File; +import java.io.Serializable; +import java.util.Iterator; public class Index extends NamedSet implements Serializable { diff --git a/src/enginuity/newmaps/definition/index/IndexBuilder.java b/src/enginuity/newmaps/definition/index/IndexBuilder.java index c6c8d510..756b4b12 100644 --- a/src/enginuity/newmaps/definition/index/IndexBuilder.java +++ b/src/enginuity/newmaps/definition/index/IndexBuilder.java @@ -22,14 +22,14 @@ package enginuity.newmaps.definition.index; import enginuity.newmaps.xml.SaxParserFactory; +import enginuity.util.exception.NameableNotFoundException; +import org.xml.sax.SAXParseException; + import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectOutputStream; -import static enginuity.util.MD5Checksum.getMD5Checksum; -import enginuity.util.exception.NameableNotFoundException; -import org.xml.sax.SAXParseException; public class IndexBuilder { diff --git a/src/enginuity/newmaps/definition/index/IndexItem.java b/src/enginuity/newmaps/definition/index/IndexItem.java index c3a52d93..7dce5fb3 100644 --- a/src/enginuity/newmaps/definition/index/IndexItem.java +++ b/src/enginuity/newmaps/definition/index/IndexItem.java @@ -21,10 +21,11 @@ package enginuity.newmaps.definition.index; +import static enginuity.util.MD5Checksum.getMD5Checksum; import enginuity.util.Nameable; + import java.io.File; import java.io.Serializable; -import static enginuity.util.MD5Checksum.getMD5Checksum; public class IndexItem implements Nameable, Serializable { diff --git a/src/enginuity/newmaps/definition/index/IndexUtil.java b/src/enginuity/newmaps/definition/index/IndexUtil.java index 8d273a02..1de9abfa 100644 --- a/src/enginuity/newmaps/definition/index/IndexUtil.java +++ b/src/enginuity/newmaps/definition/index/IndexUtil.java @@ -23,15 +23,14 @@ package enginuity.newmaps.definition.index; import enginuity.newmaps.definition.RomDefinitionHandler; import enginuity.newmaps.xml.SaxParserFactory; +import static enginuity.util.MD5Checksum.getMD5Checksum; + +import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; -import java.io.IOException; +import java.io.InputStream; import java.io.ObjectInputStream; import java.util.Iterator; -import static enginuity.util.MD5Checksum.getMD5Checksum; -import java.io.BufferedInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; public abstract class IndexUtil { diff --git a/src/enginuity/newmaps/definition/translate/DefinitionBuilder.java b/src/enginuity/newmaps/definition/translate/DefinitionBuilder.java index 7d0e44de..901c549e 100644 --- a/src/enginuity/newmaps/definition/translate/DefinitionBuilder.java +++ b/src/enginuity/newmaps/definition/translate/DefinitionBuilder.java @@ -32,13 +32,14 @@ import enginuity.maps.Table3D; import enginuity.maps.TableSwitch; import enginuity.newmaps.xml.XmlHelper; import enginuity.util.HexUtil; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Text; + import java.io.File; import java.io.FileOutputStream; import java.util.Iterator; import java.util.Vector; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; public class DefinitionBuilder { diff --git a/src/enginuity/newmaps/definition/translate/FirstGenDefinitionHandler.java b/src/enginuity/newmaps/definition/translate/FirstGenDefinitionHandler.java index 893fd7ad..f5778126 100644 --- a/src/enginuity/newmaps/definition/translate/FirstGenDefinitionHandler.java +++ b/src/enginuity/newmaps/definition/translate/FirstGenDefinitionHandler.java @@ -33,14 +33,15 @@ import enginuity.maps.Table1D; import enginuity.maps.Table2D; import enginuity.maps.Table3D; import enginuity.maps.TableSwitch; +import enginuity.util.ObjectCloner; import static enginuity.xml.DOMHelper.unmarshallAttribute; import static enginuity.xml.DOMHelper.unmarshallText; -import enginuity.util.ObjectCloner; import enginuity.xml.RomAttributeParser; import enginuity.xml.TableIsOmittedException; import org.w3c.dom.Node; import static org.w3c.dom.Node.ELEMENT_NODE; import org.w3c.dom.NodeList; + import javax.management.modelmbean.XMLParseException; import java.util.ArrayList; import java.util.Iterator; diff --git a/src/enginuity/newmaps/definition/translate/FirstGenTranslator.java b/src/enginuity/newmaps/definition/translate/FirstGenTranslator.java index fb781aee..561da46a 100644 --- a/src/enginuity/newmaps/definition/translate/FirstGenTranslator.java +++ b/src/enginuity/newmaps/definition/translate/FirstGenTranslator.java @@ -23,11 +23,12 @@ package enginuity.newmaps.definition.translate; import com.sun.org.apache.xerces.internal.parsers.DOMParser; import enginuity.maps.Rom; +import org.w3c.dom.Document; +import org.xml.sax.InputSource; + import java.io.File; import java.io.FileInputStream; import java.util.Vector; -import org.w3c.dom.Document; -import org.xml.sax.InputSource; public class FirstGenTranslator { diff --git a/src/enginuity/newmaps/ecudata/Category.java b/src/enginuity/newmaps/ecudata/Category.java index c1700b3c..3ab2fb14 100644 --- a/src/enginuity/newmaps/ecudata/Category.java +++ b/src/enginuity/newmaps/ecudata/Category.java @@ -23,6 +23,7 @@ package enginuity.newmaps.ecudata; import enginuity.util.Nameable; import enginuity.util.NamedSet; + import java.io.Serializable; import java.util.Iterator; diff --git a/src/enginuity/newmaps/ecudata/ECUData.java b/src/enginuity/newmaps/ecudata/ECUData.java index ff3d76b9..e512d076 100644 --- a/src/enginuity/newmaps/ecudata/ECUData.java +++ b/src/enginuity/newmaps/ecudata/ECUData.java @@ -22,6 +22,7 @@ package enginuity.newmaps.ecudata; import enginuity.util.Nameable; + import java.io.Serializable; public abstract class ECUData implements Nameable, Serializable { diff --git a/src/enginuity/newmaps/ecudata/Rom.java b/src/enginuity/newmaps/ecudata/Rom.java index 62578226..5ce39747 100644 --- a/src/enginuity/newmaps/ecudata/Rom.java +++ b/src/enginuity/newmaps/ecudata/Rom.java @@ -23,6 +23,7 @@ package enginuity.newmaps.ecudata; import enginuity.util.Nameable; import enginuity.util.NamedSet; + import java.io.Serializable; public class Rom implements Nameable, Serializable { diff --git a/src/enginuity/newmaps/ecudata/Scale.java b/src/enginuity/newmaps/ecudata/Scale.java index 53d95da4..d599028f 100644 --- a/src/enginuity/newmaps/ecudata/Scale.java +++ b/src/enginuity/newmaps/ecudata/Scale.java @@ -22,6 +22,7 @@ package enginuity.newmaps.ecudata; import enginuity.util.Nameable; + import java.io.Serializable; public class Scale implements Nameable, Serializable { diff --git a/src/enginuity/newmaps/ecudata/SourceDefAxis.java b/src/enginuity/newmaps/ecudata/SourceDefAxis.java index d85413c2..e7ec3081 100644 --- a/src/enginuity/newmaps/ecudata/SourceDefAxis.java +++ b/src/enginuity/newmaps/ecudata/SourceDefAxis.java @@ -22,6 +22,7 @@ package enginuity.newmaps.ecudata; import static enginuity.newmaps.definition.AttributeParser.stringToStringArray; + import java.io.Serializable; public class SourceDefAxis extends Axis implements Serializable { diff --git a/src/enginuity/newmaps/ecudata/Switch.java b/src/enginuity/newmaps/ecudata/Switch.java index 9b7811a3..7f4cced5 100644 --- a/src/enginuity/newmaps/ecudata/Switch.java +++ b/src/enginuity/newmaps/ecudata/Switch.java @@ -21,9 +21,10 @@ package enginuity.newmaps.ecudata; -import java.io.Serializable; import static enginuity.newmaps.definition.AttributeParser.stringToByteArray; +import java.io.Serializable; + public class Switch extends ECUData implements Serializable { protected byte[] stateOn = new byte[1]; diff --git a/src/enginuity/newmaps/ecudata/SwitchGroup.java b/src/enginuity/newmaps/ecudata/SwitchGroup.java index 2556eb17..5db0ef33 100644 --- a/src/enginuity/newmaps/ecudata/SwitchGroup.java +++ b/src/enginuity/newmaps/ecudata/SwitchGroup.java @@ -23,6 +23,7 @@ package enginuity.newmaps.ecudata; import enginuity.util.NamedSet; import enginuity.util.exception.NameableNotFoundException; + import java.util.Iterator; public class SwitchGroup extends ECUData { diff --git a/src/enginuity/newmaps/ecudata/Unit.java b/src/enginuity/newmaps/ecudata/Unit.java index 0d87c6e2..dc351096 100644 --- a/src/enginuity/newmaps/ecudata/Unit.java +++ b/src/enginuity/newmaps/ecudata/Unit.java @@ -22,6 +22,7 @@ package enginuity.newmaps.ecudata; import enginuity.util.Nameable; + import java.io.Serializable; public class Unit implements Nameable, Serializable { diff --git a/src/enginuity/newmaps/swing/Table.java b/src/enginuity/newmaps/swing/Table.java index c1e870cf..675fa754 100644 --- a/src/enginuity/newmaps/swing/Table.java +++ b/src/enginuity/newmaps/swing/Table.java @@ -21,8 +21,7 @@ package enginuity.newmaps.swing; -import javax.swing.JTable; -import javax.swing.ListSelectionModel; +import javax.swing.*; import javax.swing.event.ListSelectionListener; public class Table extends JTable implements ListSelectionModel { diff --git a/src/enginuity/newmaps/swing/TableFrame.java b/src/enginuity/newmaps/swing/TableFrame.java index 0e7bcea6..2990a582 100644 --- a/src/enginuity/newmaps/swing/TableFrame.java +++ b/src/enginuity/newmaps/swing/TableFrame.java @@ -21,11 +21,8 @@ package enginuity.newmaps.swing; -import java.awt.BorderLayout; -import java.awt.Color; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JScrollPane; +import javax.swing.*; +import java.awt.*; class TableFrame extends JFrame { // Instance attributes used in this example diff --git a/src/enginuity/newmaps/xml/XmlHelper.java b/src/enginuity/newmaps/xml/XmlHelper.java index d8feb9d7..a04d355e 100644 --- a/src/enginuity/newmaps/xml/XmlHelper.java +++ b/src/enginuity/newmaps/xml/XmlHelper.java @@ -22,13 +22,13 @@ package enginuity.newmaps.xml; import enginuity.logger.exception.ConfigurationException; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; +import org.xml.sax.SAXException; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -39,12 +39,13 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Text; -import org.xml.sax.SAXException; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; final public class XmlHelper extends Object { diff --git a/src/enginuity/swing/SettingsForm.java b/src/enginuity/swing/SettingsForm.java index 9eea7f16..e66c903e 100644 --- a/src/enginuity/swing/SettingsForm.java +++ b/src/enginuity/swing/SettingsForm.java @@ -25,14 +25,13 @@ import ZoeloeSoft.projects.JFontChooser.JFontChooser; import enginuity.ECUEditor; import enginuity.Settings; import enginuity.util.FileAssociator; -import java.awt.Color; -import java.awt.Dimension; + +import javax.swing.*; +import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.File; import java.util.StringTokenizer; -import javax.swing.JColorChooser; -import javax.swing.JFrame; public class SettingsForm extends JFrame implements MouseListener { diff --git a/src/enginuity/util/MD5Checksum.java b/src/enginuity/util/MD5Checksum.java index dd341e4e..d751a577 100644 --- a/src/enginuity/util/MD5Checksum.java +++ b/src/enginuity/util/MD5Checksum.java @@ -21,7 +21,8 @@ package enginuity.util; -import java.io.*; +import java.io.FileInputStream; +import java.io.InputStream; import java.security.MessageDigest; public class MD5Checksum { diff --git a/src/enginuity/util/NamedSet.java b/src/enginuity/util/NamedSet.java index 90fed26f..9a567d5a 100644 --- a/src/enginuity/util/NamedSet.java +++ b/src/enginuity/util/NamedSet.java @@ -22,6 +22,7 @@ package enginuity.util; import enginuity.util.exception.NameableNotFoundException; + import java.io.Serializable; import java.util.Collection; import java.util.Iterator; diff --git a/src/enginuity/util/ObjectCloner.java b/src/enginuity/util/ObjectCloner.java index 34214f61..33f03236 100644 --- a/src/enginuity/util/ObjectCloner.java +++ b/src/enginuity/util/ObjectCloner.java @@ -23,8 +23,6 @@ package enginuity.util; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.EOFException; -import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; diff --git a/src/enginuity/util/ThreadUtil.java b/src/enginuity/util/ThreadUtil.java index a46f29be..75f17247 100644 --- a/src/enginuity/util/ThreadUtil.java +++ b/src/enginuity/util/ThreadUtil.java @@ -32,7 +32,7 @@ public final class ThreadUtil { try { TimeUnit.MILLISECONDS.sleep(millis); } catch (InterruptedException e) { - e.printStackTrace(); + //e.printStackTrace(); } }