diff --git a/src/com/romraider/ECUExec.java b/src/com/romraider/ECUExec.java index 16e3b267..c17f7b1b 100644 --- a/src/com/romraider/ECUExec.java +++ b/src/com/romraider/ECUExec.java @@ -19,14 +19,15 @@ package com.romraider; -import static com.romraider.ECUEditorManager.getECUEditor; import static com.romraider.Version.PRODUCT_NAME; +import static com.romraider.editor.ecu.ECUEditorManager.getECUEditor; import static com.romraider.logger.ecu.EcuLogger.startLogger; import static com.romraider.swing.LookAndFeelManager.initLookAndFeel; import static com.romraider.util.LogManager.initDebugLogging; import static com.romraider.util.RomServer.isRunning; import static com.romraider.util.RomServer.sendRomToOpenInstance; import static com.romraider.util.RomServer.waitForRom; +import com.romraider.editor.ecu.ECUEditor; import com.romraider.util.SettingsManager; import com.romraider.util.SettingsManagerImpl; import org.apache.log4j.Logger; diff --git a/src/com/romraider/ECUEditor.java b/src/com/romraider/editor/ecu/ECUEditor.java similarity index 97% rename from src/com/romraider/ECUEditor.java rename to src/com/romraider/editor/ecu/ECUEditor.java index 090ad507..884072ab 100644 --- a/src/com/romraider/ECUEditor.java +++ b/src/com/romraider/editor/ecu/ECUEditor.java @@ -17,16 +17,18 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package com.romraider; +package com.romraider.editor.ecu; import com.centerkey.utils.BareBonesBrowserLaunch; import static com.romraider.Version.ECU_DEFS_URL; import static com.romraider.Version.PRODUCT_NAME; import static com.romraider.Version.VERSION; +import com.romraider.Settings; import com.romraider.logger.ecu.ui.handler.table.TableUpdateHandler; import com.romraider.maps.Rom; import com.romraider.maps.Table; import com.romraider.net.URL; +import com.romraider.swing.AbstractFrame; import com.romraider.swing.ECUEditorMenuBar; import com.romraider.swing.ECUEditorToolBar; import com.romraider.swing.JProgressPane; @@ -44,7 +46,6 @@ import org.w3c.dom.Document; import org.xml.sax.InputSource; import javax.swing.ImageIcon; import javax.swing.JCheckBox; -import javax.swing.JFrame; import javax.swing.JLabel; import static javax.swing.JOptionPane.DEFAULT_OPTION; import static javax.swing.JOptionPane.ERROR_MESSAGE; @@ -65,9 +66,7 @@ import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; @@ -76,10 +75,10 @@ import java.io.FileReader; import java.io.IOException; import java.util.Vector; -public class ECUEditor extends JFrame implements WindowListener, PropertyChangeListener { - private static final long serialVersionUID = -7826850987392016292L; +public class ECUEditor extends AbstractFrame { + private static final long serialVersionUID = -7826850987392016292L; - private String titleText = PRODUCT_NAME + " v" + VERSION + " | ECU Editor"; + private String titleText = PRODUCT_NAME + " v" + VERSION + " | ECU Editor"; private static final String NEW_LINE = System.getProperty("line.separator"); private final SettingsManager settingsManager = new SettingsManagerImpl(); @@ -135,7 +134,7 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL addWindowListener(this); setTitle(titleText); setVisible(true); - + if (settings.getEcuDefinitionFiles().size() <= 0) { // no ECU definitions configured - let user choose to get latest or configure later Object[] options = {"Yes", "No"}; diff --git a/src/com/romraider/ECUEditorManager.java b/src/com/romraider/editor/ecu/ECUEditorManager.java similarity index 97% rename from src/com/romraider/ECUEditorManager.java rename to src/com/romraider/editor/ecu/ECUEditorManager.java index 6f34f9e5..b81ebb60 100644 --- a/src/com/romraider/ECUEditorManager.java +++ b/src/com/romraider/editor/ecu/ECUEditorManager.java @@ -17,10 +17,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package com.romraider; +package com.romraider.editor.ecu; import javax.swing.SwingUtilities; + public class ECUEditorManager { private static ECUEditor editor = null; diff --git a/src/com/romraider/logger/ecu/EcuLogger.java b/src/com/romraider/logger/ecu/EcuLogger.java index 062374df..a30487cc 100644 --- a/src/com/romraider/logger/ecu/EcuLogger.java +++ b/src/com/romraider/logger/ecu/EcuLogger.java @@ -20,11 +20,12 @@ package com.romraider.logger.ecu; import static com.centerkey.utils.BareBonesBrowserLaunch.openURL; -import com.romraider.ECUEditor; import com.romraider.Settings; import static com.romraider.Version.LOGGER_DEFS_URL; import static com.romraider.Version.PRODUCT_NAME; import static com.romraider.Version.VERSION; +import com.romraider.swing.AbstractFrame; +import com.romraider.editor.ecu.ECUEditor; import com.romraider.io.serial.port.SerialPortRefresher; import com.romraider.logger.ecu.comms.controller.LoggerController; import com.romraider.logger.ecu.comms.controller.LoggerControllerImpl; @@ -140,9 +141,7 @@ import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; import java.io.File; import static java.lang.System.currentTimeMillis; import java.util.ArrayList; @@ -163,7 +162,7 @@ TODO: Add custom graph tab (eg. engine speed vs. boost, etc.) TODO: Add log analysis tab (or maybe new window?), including log playback, custom graphs, map compare, etc */ -public final class EcuLogger extends JFrame implements WindowListener, PropertyChangeListener, MessageListener { +public final class EcuLogger extends AbstractFrame implements MessageListener { private static final long serialVersionUID = 7145423251696282784L; private static final Logger LOGGER = Logger.getLogger(EcuLogger.class); private static final String ECU_LOGGER_TITLE = PRODUCT_NAME + " v" + VERSION + " | ECU Logger"; diff --git a/src/com/romraider/logger/ecu/ui/tab/Tab.java b/src/com/romraider/logger/ecu/ui/tab/Tab.java index 099db89d..06fc85b4 100644 --- a/src/com/romraider/logger/ecu/ui/tab/Tab.java +++ b/src/com/romraider/logger/ecu/ui/tab/Tab.java @@ -19,10 +19,31 @@ package com.romraider.logger.ecu.ui.tab; +import java.util.List; + import javax.swing.JPanel; +import com.romraider.logger.ecu.definition.EcuParameter; +import com.romraider.logger.ecu.definition.EcuSwitch; +import com.romraider.logger.ecu.definition.ExternalData; + +/** + * Interface for Logger tabs that have the following: + * + * Control panel where logging information and constraints are set + * ChartPanel where graph of data is displayed + * + */ public interface Tab { JPanel getPanel(); - boolean isValidMafvChange(double value); + boolean isRecordData(); + + void addData(double xData, double yData); + + void setEcuParams(List params); + + void setEcuSwitches(List switches); + + void setExternalDatas(List external); } diff --git a/src/com/romraider/logger/ecu/ui/tab/injector/InjectorControlPanel.java b/src/com/romraider/logger/ecu/ui/tab/injector/InjectorControlPanel.java index 5f0f3181..9db73c5e 100644 --- a/src/com/romraider/logger/ecu/ui/tab/injector/InjectorControlPanel.java +++ b/src/com/romraider/logger/ecu/ui/tab/injector/InjectorControlPanel.java @@ -19,7 +19,7 @@ package com.romraider.logger.ecu.ui.tab.injector; -import com.romraider.ECUEditor; +import com.romraider.editor.ecu.ECUEditor; import com.romraider.logger.ecu.definition.EcuParameter; import com.romraider.logger.ecu.definition.EcuSwitch; import com.romraider.logger.ecu.definition.ExternalData; diff --git a/src/com/romraider/logger/ecu/ui/tab/injector/InjectorTab.java b/src/com/romraider/logger/ecu/ui/tab/injector/InjectorTab.java index e79e2416..e37604ff 100644 --- a/src/com/romraider/logger/ecu/ui/tab/injector/InjectorTab.java +++ b/src/com/romraider/logger/ecu/ui/tab/injector/InjectorTab.java @@ -19,11 +19,7 @@ package com.romraider.logger.ecu.ui.tab.injector; -import com.romraider.logger.ecu.definition.EcuParameter; -import com.romraider.logger.ecu.definition.EcuSwitch; -import com.romraider.logger.ecu.definition.ExternalData; import com.romraider.logger.ecu.ui.tab.Tab; -import java.util.List; public interface InjectorTab extends Tab { @@ -31,8 +27,6 @@ public interface InjectorTab extends Tab { double getFuelDensity(); - boolean isRecordData(); - boolean isValidClOl(double value); boolean isValidAfr(double value); @@ -41,17 +35,12 @@ public interface InjectorTab extends Tab { boolean isValidMaf(double value); + boolean isValidMafvChange(double value); + boolean isValidCoolantTemp(double value); boolean isValidIntakeAirTemp(double value); boolean isValidTipInThrottle(double value); - void addData(double mafv, double correction); - - void setEcuParams(List params); - - void setEcuSwitches(List switches); - - void setExternalDatas(List external); } \ No newline at end of file diff --git a/src/com/romraider/logger/ecu/ui/tab/injector/InjectorTabImpl.java b/src/com/romraider/logger/ecu/ui/tab/injector/InjectorTabImpl.java index eb7fbde6..65f01059 100644 --- a/src/com/romraider/logger/ecu/ui/tab/injector/InjectorTabImpl.java +++ b/src/com/romraider/logger/ecu/ui/tab/injector/InjectorTabImpl.java @@ -19,7 +19,7 @@ package com.romraider.logger.ecu.ui.tab.injector; -import com.romraider.ECUEditor; +import com.romraider.editor.ecu.ECUEditor; import com.romraider.logger.ecu.definition.EcuParameter; import com.romraider.logger.ecu.definition.EcuSwitch; import com.romraider.logger.ecu.definition.ExternalData; @@ -91,8 +91,8 @@ public final class InjectorTabImpl extends JPanel implements InjectorTab { return controlPanel.isValidTipInThrottle(value); } - public void addData(double mafv, double correction) { - chartPanel.addData(mafv, correction); + public void addData(double pulseWidth, double fuelcc) { + chartPanel.addData(pulseWidth, fuelcc); } public void setEcuParams(List params) { diff --git a/src/com/romraider/logger/ecu/ui/tab/maf/MafControlPanel.java b/src/com/romraider/logger/ecu/ui/tab/maf/MafControlPanel.java index bf2b82c5..0fca6ba1 100644 --- a/src/com/romraider/logger/ecu/ui/tab/maf/MafControlPanel.java +++ b/src/com/romraider/logger/ecu/ui/tab/maf/MafControlPanel.java @@ -19,7 +19,7 @@ package com.romraider.logger.ecu.ui.tab.maf; -import com.romraider.ECUEditor; +import com.romraider.editor.ecu.ECUEditor; import com.romraider.logger.ecu.definition.EcuParameter; import com.romraider.logger.ecu.definition.EcuSwitch; import com.romraider.logger.ecu.definition.ExternalData; diff --git a/src/com/romraider/logger/ecu/ui/tab/maf/MafTab.java b/src/com/romraider/logger/ecu/ui/tab/maf/MafTab.java index cc89f4cb..4307b283 100644 --- a/src/com/romraider/logger/ecu/ui/tab/maf/MafTab.java +++ b/src/com/romraider/logger/ecu/ui/tab/maf/MafTab.java @@ -19,16 +19,11 @@ package com.romraider.logger.ecu.ui.tab.maf; -import com.romraider.logger.ecu.definition.EcuParameter; -import com.romraider.logger.ecu.definition.EcuSwitch; -import com.romraider.logger.ecu.definition.ExternalData; import com.romraider.logger.ecu.ui.tab.Tab; -import java.util.List; public interface MafTab extends Tab { - boolean isRecordData(); - boolean isValidClOl(double value); + boolean isValidClOl(double value); boolean isValidAfr(double value); @@ -36,17 +31,12 @@ public interface MafTab extends Tab { boolean isValidMaf(double value); + boolean isValidMafvChange(double value); + boolean isValidCoolantTemp(double value); boolean isValidIntakeAirTemp(double value); boolean isValidTipInThrottle(double value); - void addData(double mafv, double correction); - - void setEcuParams(List params); - - void setEcuSwitches(List switches); - - void setExternalDatas(List external); } diff --git a/src/com/romraider/logger/ecu/ui/tab/maf/MafTabImpl.java b/src/com/romraider/logger/ecu/ui/tab/maf/MafTabImpl.java index 6295401e..b60bf953 100644 --- a/src/com/romraider/logger/ecu/ui/tab/maf/MafTabImpl.java +++ b/src/com/romraider/logger/ecu/ui/tab/maf/MafTabImpl.java @@ -19,7 +19,7 @@ package com.romraider.logger.ecu.ui.tab.maf; -import com.romraider.ECUEditor; +import com.romraider.editor.ecu.ECUEditor; import com.romraider.logger.ecu.definition.EcuParameter; import com.romraider.logger.ecu.definition.EcuSwitch; import com.romraider.logger.ecu.definition.ExternalData; diff --git a/src/com/romraider/maps/Rom.java b/src/com/romraider/maps/Rom.java index 36c04e0f..aeda1297 100644 --- a/src/com/romraider/maps/Rom.java +++ b/src/com/romraider/maps/Rom.java @@ -19,7 +19,7 @@ package com.romraider.maps; -import com.romraider.ECUEditor; +import com.romraider.editor.ecu.ECUEditor; import com.romraider.logger.ecu.ui.handler.table.TableUpdateHandler; import com.romraider.swing.JProgressPane; import com.romraider.xml.TableNotFoundException; diff --git a/src/com/romraider/ramtune/test/RamTuneTestApp.java b/src/com/romraider/ramtune/test/RamTuneTestApp.java index e5159ac7..84e1b510 100644 --- a/src/com/romraider/ramtune/test/RamTuneTestApp.java +++ b/src/com/romraider/ramtune/test/RamTuneTestApp.java @@ -20,6 +20,7 @@ package com.romraider.ramtune.test; import com.romraider.Settings; +import com.romraider.swing.AbstractFrame; import com.romraider.io.connection.ConnectionProperties; import com.romraider.io.protocol.Protocol; import com.romraider.io.protocol.ssm.SSMProtocol; @@ -41,7 +42,6 @@ import static com.romraider.util.ThreadUtil.sleep; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComboBox; -import javax.swing.JFrame; import javax.swing.JLabel; import static javax.swing.JOptionPane.ERROR_MESSAGE; import static javax.swing.JOptionPane.WARNING_MESSAGE; @@ -72,8 +72,6 @@ import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; @@ -85,7 +83,7 @@ import java.util.List; * * It is also a bit of a mess and needs to be cleaned up... */ -public final class RamTuneTestApp extends JFrame implements WindowListener { +public final class RamTuneTestApp extends AbstractFrame { private static final long serialVersionUID = 7140513114169019846L; private static final String REGEX_VALID_ADDRESS_BYTES = "[0-9a-fA-F]{6}"; private static final String REGEX_VALID_DATA_BYTES = "[0-9a-fA-F]{2,}"; @@ -387,27 +385,6 @@ public final class RamTuneTestApp extends JFrame implements WindowListener { showMessageDialog(this, message, "Error", ERROR_MESSAGE); } - public void windowOpened(WindowEvent e) { - } - - public void windowClosing(WindowEvent e) { - } - - public void windowClosed(WindowEvent e) { - } - - public void windowIconified(WindowEvent e) { - } - - public void windowDeiconified(WindowEvent e) { - } - - public void windowActivated(WindowEvent e) { - } - - public void windowDeactivated(WindowEvent e) { - } - //********************************************************************** public static void main(String[] args) { diff --git a/src/com/romraider/swing/AbstractFrame.java b/src/com/romraider/swing/AbstractFrame.java new file mode 100644 index 00000000..38f60f54 --- /dev/null +++ b/src/com/romraider/swing/AbstractFrame.java @@ -0,0 +1,65 @@ +/* + * RomRaider Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006-2009 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.swing; + +import java.awt.HeadlessException; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import javax.swing.JFrame; + + +public abstract class AbstractFrame extends JFrame implements WindowListener, PropertyChangeListener { + public AbstractFrame() throws HeadlessException { + super(); + } + + public AbstractFrame(String arg0) throws HeadlessException { + super(arg0); + } + + private static final long serialVersionUID = 7948304087075622157L; + + public void windowActivated(WindowEvent arg0) { + } + + public void windowClosed(WindowEvent e) { + } + + public void windowClosing(WindowEvent e) { + } + + public void windowDeactivated(WindowEvent e) { + } + + public void windowDeiconified(WindowEvent e) { + } + + public void windowIconified(WindowEvent e) { + } + + public void windowOpened(WindowEvent e) { + } + + public void propertyChange(PropertyChangeEvent arg0) { + } + +} diff --git a/src/com/romraider/swing/DefinitionManager.java b/src/com/romraider/swing/DefinitionManager.java index 004e5a68..24bdaf03 100644 --- a/src/com/romraider/swing/DefinitionManager.java +++ b/src/com/romraider/swing/DefinitionManager.java @@ -19,7 +19,8 @@ package com.romraider.swing; -import com.romraider.ECUEditor; +import com.romraider.editor.ecu.ECUEditor; + import javax.swing.JFileChooser; import javax.swing.ListSelectionModel; import java.awt.Font; diff --git a/src/com/romraider/swing/ECUEditorMenuBar.java b/src/com/romraider/swing/ECUEditorMenuBar.java index ebb046f1..6d53dee7 100644 --- a/src/com/romraider/swing/ECUEditorMenuBar.java +++ b/src/com/romraider/swing/ECUEditorMenuBar.java @@ -20,13 +20,14 @@ package com.romraider.swing; import com.centerkey.utils.BareBonesBrowserLaunch; -import com.romraider.ECUEditor; import static com.romraider.Version.ABOUT_ICON; import static com.romraider.Version.BUILDNUMBER; import static com.romraider.Version.ECU_DEFS_URL; import static com.romraider.Version.PRODUCT_NAME; import static com.romraider.Version.SUPPORT_URL; import static com.romraider.Version.VERSION; + +import com.romraider.editor.ecu.ECUEditor; import com.romraider.logger.ecu.EcuLogger; import com.romraider.maps.Rom; import com.romraider.ramtune.test.RamTuneTestApp; diff --git a/src/com/romraider/swing/ECUEditorToolBar.java b/src/com/romraider/swing/ECUEditorToolBar.java index bd6074b8..f403a73e 100644 --- a/src/com/romraider/swing/ECUEditorToolBar.java +++ b/src/com/romraider/swing/ECUEditorToolBar.java @@ -19,7 +19,7 @@ package com.romraider.swing; -import com.romraider.ECUEditor; +import com.romraider.editor.ecu.ECUEditor; import com.romraider.maps.Rom; import static javax.swing.BorderFactory.createLineBorder; import javax.swing.ImageIcon; diff --git a/src/com/romraider/swing/RomTree.java b/src/com/romraider/swing/RomTree.java index 0a7952e5..93cbc509 100644 --- a/src/com/romraider/swing/RomTree.java +++ b/src/com/romraider/swing/RomTree.java @@ -19,7 +19,8 @@ package com.romraider.swing; -import com.romraider.ECUEditor; +import com.romraider.editor.ecu.ECUEditor; + import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; diff --git a/src/com/romraider/swing/RomTreeNode.java b/src/com/romraider/swing/RomTreeNode.java index a429ec95..f62e3d4d 100644 --- a/src/com/romraider/swing/RomTreeNode.java +++ b/src/com/romraider/swing/RomTreeNode.java @@ -78,7 +78,7 @@ public class RomTreeNode extends DefaultMutableTreeNode { DefaultMutableTreeNode category = getChildAt(i); // loop through tables in each category - for (Enumeration j = category.children(); j.hasMoreElements();) { + for (Enumeration j = category.children(); j.hasMoreElements();) { ((TableTreeNode) j.nextElement()).getFrame().dispose(); } diff --git a/src/com/romraider/swing/SettingsForm.java b/src/com/romraider/swing/SettingsForm.java index 389dcf76..4cd95182 100644 --- a/src/com/romraider/swing/SettingsForm.java +++ b/src/com/romraider/swing/SettingsForm.java @@ -20,9 +20,10 @@ package com.romraider.swing; import ZoeloeSoft.projects.JFontChooser.JFontChooser; -import com.romraider.ECUEditor; import com.romraider.Settings; import static com.romraider.Version.PRODUCT_NAME; + +import com.romraider.editor.ecu.ECUEditor; import com.romraider.util.FileAssociator; import javax.swing.JColorChooser; import javax.swing.JFrame; diff --git a/src/com/romraider/xml/DOMRomUnmarshaller.java b/src/com/romraider/xml/DOMRomUnmarshaller.java index bbb99671..6cecb691 100644 --- a/src/com/romraider/xml/DOMRomUnmarshaller.java +++ b/src/com/romraider/xml/DOMRomUnmarshaller.java @@ -21,8 +21,8 @@ package com.romraider.xml; -import com.romraider.ECUEditor; import com.romraider.Settings; +import com.romraider.editor.ecu.ECUEditor; import com.romraider.maps.DataCell; import com.romraider.maps.Rom; import com.romraider.maps.RomID;