White space cleanup

This commit is contained in:
BlackMamba 2015-04-01 17:15:45 -04:00 committed by Dale Schultz
parent df69468c6c
commit c15754e246
8 changed files with 182 additions and 182 deletions

View File

@ -1,6 +1,6 @@
/* /*
* RomRaider Open-Source Tuning, Logging and Reflashing * RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com * Copyright (C) 2006-2015 RomRaider.com
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -24,17 +24,17 @@ package com.romraider;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
public final class Version { public final class Version {
public static final String PRODUCT_NAME = "@name.package@"; public static final String PRODUCT_NAME = "@name.package@";
public static final String VERSION = "@version.major@.@version.minor@.@version.patch@ @version.extra@ @version.extra1@"; public static final String VERSION = "@version.major@.@version.minor@.@version.patch@ @version.extra@ @version.extra1@";
public static final String BUILDNUMBER = "@version.buildnumber@"; public static final String BUILDNUMBER = "@version.buildnumber@";
public static final String SUPPORT_URL = "@supporturl@"; public static final String SUPPORT_URL = "@supporturl@";
public static final String ROM_REVISION_URL = "@romrevisionurl@"; public static final String ROM_REVISION_URL = "@romrevisionurl@";
public static final String ECU_DEFS_URL = "@ecudefsurl@"; public static final String ECU_DEFS_URL = "@ecudefsurl@";
public static final String LOGGER_DEFS_URL = "@loggerdefsurl@"; public static final String LOGGER_DEFS_URL = "@loggerdefsurl@";
public static final String CARS_DEFS_URL = "@carsdefsurl@"; public static final String CARS_DEFS_URL = "@carsdefsurl@";
public static final String RELEASE_NOTES = "@release_notes@"; public static final String RELEASE_NOTES = "@release_notes@";
public static final ImageIcon ABOUT_ICON = new ImageIcon(Version.class.getClass().getResource("/graphics/romraider-ico-large.gif")); public static final ImageIcon ABOUT_ICON = new ImageIcon(Version.class.getClass().getResource("/graphics/romraider-ico-large.gif"));
public static final int MIN_LOG_DEF_VERSION = @min.logger.def.version@; public static final int MIN_LOG_DEF_VERSION = @min.logger.def.version@;
private Version() { private Version() {
} }

View File

@ -224,7 +224,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
private static final String LOG_TO_FILE_ICON = "/graphics/logger_log_to_file.png"; private static final String LOG_TO_FILE_ICON = "/graphics/logger_log_to_file.png";
private static final String LOG_TO_FILE_START = "Start file log"; private static final String LOG_TO_FILE_START = "Start file log";
private static final String LOG_TO_FILE_STOP = "Stop file log"; private static final String LOG_TO_FILE_STOP = "Stop file log";
private static final String LOG_TO_FILE_TT_TEXT = "Start/stop file logging (F1)"; private static final String LOG_TO_FILE_TT_TEXT = "Start/stop file logging (F1)";
private static String target = "ECU"; private static String target = "ECU";
private static String loadResult = ""; private static String loadResult = "";
private String defVersion; private String defVersion;
@ -286,7 +286,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
new HashMap<String, Map<Transport, Collection<Module>>>(); new HashMap<String, Map<Transport, Collection<Module>>>();
private Map<String, Object> componentList = new HashMap<String, Object>(); private Map<String, Object> componentList = new HashMap<String, Object>();
private static boolean touchEnabled = false; private static boolean touchEnabled = false;
public EcuLogger() { public EcuLogger() {
super(ECU_LOGGER_TITLE); super(ECU_LOGGER_TITLE);
construct(); construct();
@ -303,11 +303,11 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
// fail until we actually try to use them since the logger requires // fail until we actually try to use them since the logger requires
// these libraries, this is a hard error here // these libraries, this is a hard error here
if (!JREChecker.is32bit()) { if (!JREChecker.is32bit()) {
showMessageDialog(null, showMessageDialog(null,
"Incompatible JRE detected.\n" + "Incompatible JRE detected.\n" +
PRODUCT_NAME + PRODUCT_NAME +
" RomRaider Logger requires a 32-bit JRE.\nLogger will now exit.", " RomRaider Logger requires a 32-bit JRE.\nLogger will now exit.",
"JRE Incompatibility Error", "JRE Incompatibility Error",
ERROR_MESSAGE); ERROR_MESSAGE);
// this will generate a NullPointerException because we never got // this will generate a NullPointerException because we never got
// things started // things started
@ -897,48 +897,11 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
dashboardHandlerManager.addHandler(TableUpdateHandler.getInstance()); dashboardHandlerManager.addHandler(TableUpdateHandler.getInstance());
} }
private JComponent buildTabbedPane() { private JComponent buildTabbedPane() {
if (touchEnabled == false) if (touchEnabled == false)
{ {
addSplitPaneTab(
"Data",
buildSplitPane(
buildParamListPane(
dataTabParamListTableModel,
dataTabSwitchListTableModel,
dataTabExternalListTableModel),
buildDataTab()),
buildUnselectAllButton(),
buildLtvButton());
addSplitPaneTab(
"Graph",
buildSplitPane(
buildParamListPane(
graphTabParamListTableModel,
graphTabSwitchListTableModel,
graphTabExternalListTableModel),
buildGraphTab()),
buildUnselectAllButton(),
buildLtvButton());
addSplitPaneTab(
"Dashboard",
buildSplitPane(
buildParamListPane(
dashboardTabParamListTableModel,
dashboardTabSwitchListTableModel,
dashboardTabExternalListTableModel),
buildDashboardTab()),
buildUnselectAllButton(),
buildLtvButton(),
buildToggleGaugeStyleButton());
tabbedPane.add("MAF", mafTab.getPanel());
tabbedPane.add("Injector", injectorTab.getPanel());
tabbedPane.add("Dyno", dynoTab.getPanel());
}
else
{
addSplitPaneTab( addSplitPaneTab(
"<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Data" + "</body></html>", "Data",
buildSplitPane( buildSplitPane(
buildParamListPane( buildParamListPane(
dataTabParamListTableModel, dataTabParamListTableModel,
@ -948,7 +911,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
buildUnselectAllButton(), buildUnselectAllButton(),
buildLtvButton()); buildLtvButton());
addSplitPaneTab( addSplitPaneTab(
"<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Graph" + "</body></html>", "Graph",
buildSplitPane( buildSplitPane(
buildParamListPane( buildParamListPane(
graphTabParamListTableModel, graphTabParamListTableModel,
@ -958,7 +921,44 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
buildUnselectAllButton(), buildUnselectAllButton(),
buildLtvButton()); buildLtvButton());
addSplitPaneTab( addSplitPaneTab(
"<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Dashboard" + "</body></html>", "Dashboard",
buildSplitPane(
buildParamListPane(
dashboardTabParamListTableModel,
dashboardTabSwitchListTableModel,
dashboardTabExternalListTableModel),
buildDashboardTab()),
buildUnselectAllButton(),
buildLtvButton(),
buildToggleGaugeStyleButton());
tabbedPane.add("MAF", mafTab.getPanel());
tabbedPane.add("Injector", injectorTab.getPanel());
tabbedPane.add("Dyno", dynoTab.getPanel());
}
else
{
addSplitPaneTab(
"<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Data" + "</body></html>",
buildSplitPane(
buildParamListPane(
dataTabParamListTableModel,
dataTabSwitchListTableModel,
dataTabExternalListTableModel),
buildDataTab()),
buildUnselectAllButton(),
buildLtvButton());
addSplitPaneTab(
"<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Graph" + "</body></html>",
buildSplitPane(
buildParamListPane(
graphTabParamListTableModel,
graphTabSwitchListTableModel,
graphTabExternalListTableModel),
buildGraphTab()),
buildUnselectAllButton(),
buildLtvButton());
addSplitPaneTab(
"<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Dashboard" + "</body></html>",
buildSplitPane( buildSplitPane(
buildParamListPane( buildParamListPane(
dashboardTabParamListTableModel, dashboardTabParamListTableModel,
@ -970,7 +970,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
buildToggleGaugeStyleButton()); buildToggleGaugeStyleButton());
tabbedPane.add("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "MAF"+ "</body></html>", mafTab.getPanel()); tabbedPane.add("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "MAF"+ "</body></html>", mafTab.getPanel());
tabbedPane.add("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Injector"+ "</body></html>", injectorTab.getPanel()); tabbedPane.add("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Injector"+ "</body></html>", injectorTab.getPanel());
tabbedPane.add("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Dyno" + "</body></html>", dynoTab.getPanel()); tabbedPane.add("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Dyno" + "</body></html>", dynoTab.getPanel());
} }
return tabbedPane; return tabbedPane;
} }
@ -1083,7 +1083,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
} }
else else
{ {
button.setPreferredSize(new Dimension(56, 60)); button.setPreferredSize(new Dimension(56, 60));
} }
button.addActionListener(new LearningTableValuesAction(this)); button.addActionListener(new LearningTableValuesAction(this));
return button; return button;
@ -1102,7 +1102,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
} }
else else
{ {
toggleListButton.setPreferredSize(new Dimension(56, 95)); toggleListButton.setPreferredSize(new Dimension(56, 95));
} }
toggleListButton.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(getKeyStroke("F11"), "toggleHideParams"); toggleListButton.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(getKeyStroke("F11"), "toggleHideParams");
toggleListButton.getActionMap().put("toggleHideParams", new AbstractAction() { toggleListButton.getActionMap().put("toggleHideParams", new AbstractAction() {
@ -1140,11 +1140,11 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
JPanel tabControlPanel = new JPanel(new BetterFlowLayout(FlowLayout.CENTER, 1, 1)); JPanel tabControlPanel = new JPanel(new BetterFlowLayout(FlowLayout.CENTER, 1, 1));
if (touchEnabled == false) if (touchEnabled == false)
{ {
tabControlPanel.setPreferredSize(new Dimension(25, 25)); tabControlPanel.setPreferredSize(new Dimension(25, 25));
} }
else else
{ {
tabControlPanel.setPreferredSize(new Dimension(56, 25)); tabControlPanel.setPreferredSize(new Dimension(56, 25));
} }
tabControlPanel.add(toggleListButton); tabControlPanel.add(toggleListButton);
for (JComponent control : extraControls) tabControlPanel.add(control); for (JComponent control : extraControls) tabControlPanel.add(control);
@ -1161,33 +1161,33 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
JScrollPane externalList = new JScrollPane(buildParamListTable(externalListTableModel), VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); JScrollPane externalList = new JScrollPane(buildParamListTable(externalListTableModel), VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
JScrollPane switchList = new JScrollPane(buildParamListTable(switchListTableModel), VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); JScrollPane switchList = new JScrollPane(buildParamListTable(switchListTableModel), VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
JTabbedPane tabs = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT); JTabbedPane tabs = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
if (touchEnabled == false) if (touchEnabled == false)
{ {
tabs.addTab(HEADING_PARAMETERS, paramList); tabs.addTab(HEADING_PARAMETERS, paramList);
tabs.addTab(HEADING_SWITCHES, switchList); tabs.addTab(HEADING_SWITCHES, switchList);
tabs.addTab("External Sensors", externalList); tabs.addTab("External Sensors", externalList);
} }
else else
{ {
tabs.addTab("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + HEADING_PARAMETERS + "</body></html>", paramList); tabs.addTab("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + HEADING_PARAMETERS + "</body></html>", paramList);
tabs.addTab("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + HEADING_SWITCHES + "</body></html>", switchList); tabs.addTab("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + HEADING_SWITCHES + "</body></html>", switchList);
tabs.addTab("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>External Sensors</body></html>", externalList); tabs.addTab("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>External Sensors</body></html>", externalList);
} }
return tabs; return tabs;
} }
private JTable buildParamListTable(ParameterListTableModel tableModel) { private JTable buildParamListTable(ParameterListTableModel tableModel) {
JTable paramListTable = new ParameterListTable(tableModel); JTable paramListTable = new ParameterListTable(tableModel);
if( touchEnabled == false) if( touchEnabled == false)
{ {
changeColumnWidth(paramListTable, 0, 20, 55, 55); changeColumnWidth(paramListTable, 0, 20, 55, 55);
changeColumnWidth(paramListTable, 2, 50, 250, 130); changeColumnWidth(paramListTable, 2, 50, 250, 130);
} }
else else
{ {
changeColumnWidth(paramListTable, 0, 20, 75, 75); changeColumnWidth(paramListTable, 0, 20, 75, 75);
changeColumnWidth(paramListTable, 2, 50, 75, 75); changeColumnWidth(paramListTable, 2, 50, 75, 75);
} }
return paramListTable; return paramListTable;
@ -1253,14 +1253,14 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
private JSplitPane buildSplitPane(JComponent leftComponent, JComponent rightComponent) { private JSplitPane buildSplitPane(JComponent leftComponent, JComponent rightComponent) {
splitPane = new JSplitPane(HORIZONTAL_SPLIT, leftComponent, rightComponent); splitPane = new JSplitPane(HORIZONTAL_SPLIT, leftComponent, rightComponent);
splitPane.setDividerSize(5); splitPane.setDividerSize(5);
if (touchEnabled == false) if (touchEnabled == false)
{ {
splitPane.setDividerLocation((int) getSettings().getDividerLocation()); splitPane.setDividerLocation((int) getSettings().getDividerLocation());
} }
else else
{ {
splitPane.setDividerLocation((int) getSettings().getDividerLocation()+200); splitPane.setDividerLocation((int) getSettings().getDividerLocation()+200);
} }
splitPane.addPropertyChangeListener(this); splitPane.addPropertyChangeListener(this);
return splitPane; return splitPane;
@ -1272,12 +1272,12 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
private JPanel buildControlToolbar() { private JPanel buildControlToolbar() {
JPanel controlPanel = new JPanel(new BorderLayout()); JPanel controlPanel = new JPanel(new BorderLayout());
if (touchEnabled == true) if (touchEnabled == true)
{ {
portsComboBox.setPreferredSize(new Dimension(100,50)); portsComboBox.setPreferredSize(new Dimension(100,50));
} }
controlPanel.add(buildPortsComboBox(), WEST); controlPanel.add(buildPortsComboBox(), WEST);
//TODO: Finish log playback stuff... //TODO: Finish log playback stuff...
// controlPanel.add(buildPlaybackControls(), CENTER); // controlPanel.add(buildPlaybackControls(), CENTER);
@ -1419,14 +1419,14 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
JPanel comboBoxPanel = new JPanel(new FlowLayout()); JPanel comboBoxPanel = new JPanel(new FlowLayout());
comboBoxPanel.add(new JLabel("COM Port:")); comboBoxPanel.add(new JLabel("COM Port:"));
comboBoxPanel.add(portsComboBox); comboBoxPanel.add(portsComboBox);
final CustomButtonGroup moduleGroup = new CustomButtonGroup(); final CustomButtonGroup moduleGroup = new CustomButtonGroup();
for (Module module : getModuleList()) { for (Module module : getModuleList()) {
final JCheckBox cb = new JCheckBox(module.getName().toUpperCase()); final JCheckBox cb = new JCheckBox(module.getName().toUpperCase());
if (touchEnabled == true) if (touchEnabled == true)
{ {
cb.setPreferredSize(new Dimension(75, 50)); cb.setPreferredSize(new Dimension(75, 50));
} }
final String tipText = String.format( final String tipText = String.format(
"%s Polling. Uncheck all boxes for Externals logging only.", "%s Polling. Uncheck all boxes for Externals logging only.",
module.getDescription()); module.getDescription());
@ -1459,11 +1459,11 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
componentList.put("reconnectButton", reconnectButton); componentList.put("reconnectButton", reconnectButton);
if (touchEnabled == false) if (touchEnabled == false)
{ {
reconnectButton.setPreferredSize(new Dimension(25, 25)); reconnectButton.setPreferredSize(new Dimension(25, 25));
} }
else else
{ {
reconnectButton.setPreferredSize(new Dimension(75, 50)); reconnectButton.setPreferredSize(new Dimension(75, 50));
} }
reconnectButton.setToolTipText("Reconnect to " + target); reconnectButton.setToolTipText("Reconnect to " + target);
reconnectButton.addActionListener(new ActionListener() { reconnectButton.addActionListener(new ActionListener() {
@ -1481,13 +1481,13 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
componentList.put("disconnectButton", disconnectButton); componentList.put("disconnectButton", disconnectButton);
if (touchEnabled == false) if (touchEnabled == false)
{ {
disconnectButton.setPreferredSize(new Dimension(25, 25)); disconnectButton.setPreferredSize(new Dimension(25, 25));
} }
else else
{ {
disconnectButton.setPreferredSize(new Dimension(75, 50)); disconnectButton.setPreferredSize(new Dimension(75, 50));
} }
disconnectButton.setToolTipText("Disconnect from " + target); disconnectButton.setToolTipText("Disconnect from " + target);
disconnectButton.addActionListener(new ActionListener() { disconnectButton.addActionListener(new ActionListener() {
@Override @Override
@ -1599,14 +1599,14 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
private JComponent buildDataTab() { private JComponent buildDataTab() {
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
JButton resetButton; JButton resetButton;
if (touchEnabled == false) if (touchEnabled == false)
{ {
resetButton = new JButton("Reset Data"); resetButton = new JButton("Reset Data");
} }
else else
{ {
resetButton = new JButton("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>Reset Data</body></html>"); resetButton = new JButton("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>Reset Data</body></html>");
} }
resetButton.addActionListener(new ActionListener() { resetButton.addActionListener(new ActionListener() {
@Override @Override
@ -1624,14 +1624,14 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
private JComponent buildGraphTab() { private JComponent buildGraphTab() {
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
JButton resetButton; JButton resetButton;
if (touchEnabled == false) if (touchEnabled == false)
{ {
resetButton = new JButton("Reset Data"); resetButton = new JButton("Reset Data");
} }
else else
{ {
resetButton = new JButton("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>Reset Data</body></html>"); resetButton = new JButton("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>Reset Data</body></html>");
} }
resetButton.addActionListener(new ActionListener() { resetButton.addActionListener(new ActionListener() {
@Override @Override
@ -1649,14 +1649,14 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
private JComponent buildDashboardTab() { private JComponent buildDashboardTab() {
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
JButton resetButton; JButton resetButton;
if (touchEnabled == false) if (touchEnabled == false)
{ {
resetButton = new JButton("Reset Data"); resetButton = new JButton("Reset Data");
} }
else else
{ {
resetButton = new JButton("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>Reset Data</body></html>"); resetButton = new JButton("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>Reset Data</body></html>");
} }
resetButton.addActionListener(new ActionListener() { resetButton.addActionListener(new ActionListener() {
@Override @Override
@ -1772,7 +1772,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
getSettings().getLoggerEcuDefinitionMap(), getSettings().getLoggerEcuDefinitionMap(),
ecuInit.getEcuId()); ecuInit.getEcuId());
final LearningTableValues learningTablesManager = final LearningTableValues learningTablesManager =
LearningTableValuesFactory.getManager( LearningTableValuesFactory.getManager(
getSettings().getLoggerProtocol()); getSettings().getLoggerProtocol());
learningTablesManager.init( learningTablesManager.init(
this, this,
@ -1926,13 +1926,13 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
public static boolean isTouchEnabled() public static boolean isTouchEnabled()
{ {
if( touchEnabled == true) if( touchEnabled == true)
{ {
return true; return true;
} }
return false;
return false;
} }
public void setRefreshMode(boolean refreshMode) { public void setRefreshMode(boolean refreshMode) {
getSettings().setRefreshMode(refreshMode); getSettings().setRefreshMode(refreshMode);
refresher.setRefreshMode(refreshMode); refresher.setRefreshMode(refreshMode);
@ -1969,8 +1969,8 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
} }
public static void startLogger(int defaultCloseOperation, String... args) { public static void startLogger(int defaultCloseOperation, String... args) {
touchEnabled = setTouchEnabled(args); touchEnabled = setTouchEnabled(args);
EcuLogger ecuLogger = new EcuLogger(); EcuLogger ecuLogger = new EcuLogger();
boolean fullscreen = containsFullScreenArg(args); boolean fullscreen = containsFullScreenArg(args);
createAndShowGui(defaultCloseOperation, ecuLogger, fullscreen); createAndShowGui(defaultCloseOperation, ecuLogger, fullscreen);

View File

@ -1,6 +1,6 @@
/* /*
* RomRaider Open-Source Tuning, Logging and Reflashing * RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com * Copyright (C) 2006-2015 RomRaider.com
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -45,7 +45,7 @@ import java.util.Map;
*/ */
public final class EcuDefinitionHandler extends DefaultHandler { public final class EcuDefinitionHandler extends DefaultHandler {
private static final Logger LOGGER = Logger.getLogger(EcuDefinitionHandler.class); private static final Logger LOGGER = Logger.getLogger(EcuDefinitionHandler.class);
private static final String TAG_ROM = "rom"; private static final String TAG_ROM = "rom";
private static final String TAG_ROMID = "romid"; private static final String TAG_ROMID = "romid";
private static final String TAG_CALID = "internalidstring"; private static final String TAG_CALID = "internalidstring";
private static final String TAG_ECUID = "ecuid"; private static final String TAG_ECUID = "ecuid";

View File

@ -1,6 +1,6 @@
/* /*
* RomRaider Open-Source Tuning, Logging and Reflashing * RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2014 RomRaider.com * Copyright (C) 2006-2015 RomRaider.com
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -26,21 +26,21 @@ import javax.swing.ButtonModel;
* Custom ButtonGroup allows none or only one button in the group to be selected. * Custom ButtonGroup allows none or only one button in the group to be selected.
*/ */
public class CustomButtonGroup extends ButtonGroup { public class CustomButtonGroup extends ButtonGroup {
private static final long serialVersionUID = 3271988244802054464L; private static final long serialVersionUID = 3271988244802054464L;
/** /**
* Sets the selected value for the ButtonModel. * Sets the selected value for the ButtonModel.
* Only one button in the group may be selected at a time but this * Only one button in the group may be selected at a time but this
* override allows a selected button to be un-selected so none in the group * override allows a selected button to be un-selected so none in the group
* are selected. * are selected.
*/ */
@Override @Override
public void setSelected(ButtonModel m, boolean b) { public void setSelected(ButtonModel m, boolean b) {
if (b && m != null && m != getSelection()) { if (b && m != null && m != getSelection()) {
super.setSelected(m, b); super.setSelected(m, b);
} }
else if (!b && m == getSelection()) { else if (!b && m == getSelection()) {
clearSelection(); clearSelection();
} }
} }
} }

View File

@ -1,6 +1,6 @@
/* /*
* RomRaider Open-Source Tuning, Logging and Reflashing * RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com * Copyright (C) 2006-2015 RomRaider.com
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -60,9 +60,9 @@ public final class UnitsComboBoxRenderer extends JComboBox implements TableCellR
class FontCellRenderer extends DefaultListCellRenderer { class FontCellRenderer extends DefaultListCellRenderer {
private static final long serialVersionUID = 5963151264549169227L; private static final long serialVersionUID = 5963151264549169227L;
public Component getListCellRendererComponent( public Component getListCellRendererComponent(
JList list, JList list,
Object value, Object value,
int index, int index,

View File

@ -1,6 +1,6 @@
/* /*
* RomRaider Open-Source Tuning, Logging and Reflashing * RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com * Copyright (C) 2006-2015 RomRaider.com
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -33,21 +33,21 @@ import com.romraider.logger.external.core.Stoppable;
import com.romraider.logger.external.txs.plugin.TxsDataItem; import com.romraider.logger.external.txs.plugin.TxsDataItem;
public final class TxsRunner implements Stoppable{ public final class TxsRunner implements Stoppable{
private static final Logger LOGGER = getLogger(TxsRunner.class); private static final Logger LOGGER = getLogger(TxsRunner.class);
private static final ConnectionProperties CONNECTION_PROPS = private static final ConnectionProperties CONNECTION_PROPS =
new TxsConnectionProperties(); new TxsConnectionProperties();
private static final String WHITESPACE_REGEX = "\\s+"; private static final String WHITESPACE_REGEX = "\\s+";
private static final String SPLIT_DELIMITER = " "; private static final String SPLIT_DELIMITER = " ";
private static final byte[] EXIT = new byte[]{24}; private static final byte[] EXIT = new byte[]{24};
private final ArrayList<TxsDataItem> dataItems; private final ArrayList<TxsDataItem> dataItems;
private final SerialConnection connection; private final SerialConnection connection;
private boolean stop; private boolean stop;
private String txsLogger; private String txsLogger;
private String txsDevice; private String txsDevice;
public TxsRunner( public TxsRunner(
String port, String port,
ArrayList<TxsDataItem> dataItems, ArrayList<TxsDataItem> dataItems,
@ -58,66 +58,66 @@ public final class TxsRunner implements Stoppable{
this.txsLogger = logger; this.txsLogger = logger;
this.txsDevice = device; this.txsDevice = device;
} }
public TxsRunner(ArrayList<TxsDataItem> dataItems) public TxsRunner(ArrayList<TxsDataItem> dataItems)
{ {
this.connection = null; this.connection = null;
this.dataItems = dataItems; this.dataItems = dataItems;
} }
public void run() { public void run() {
try { try {
LOGGER.trace("TXS Runner Begin."); LOGGER.trace("TXS Runner Begin.");
//Convert string into bytes[] //Convert string into bytes[]
byte[] device = txsDevice.getBytes(); byte[] device = txsDevice.getBytes();
byte[] logger = this.txsLogger.getBytes(); byte[] logger = this.txsLogger.getBytes();
LOGGER.trace("TXS Runner Send Exit to Main Screen."); LOGGER.trace("TXS Runner Send Exit to Main Screen.");
//Exit to main screen //Exit to main screen
connection.write(EXIT); connection.write(EXIT);
LOGGER.trace("TXS Runner Sleep 250 ms to exit to main."); LOGGER.trace("TXS Runner Sleep 250 ms to exit to main.");
//wait for exit to complete. //wait for exit to complete.
Thread.sleep(250L); Thread.sleep(250L);
LOGGER.trace("TXS Runner Readline 1."); LOGGER.trace("TXS Runner Readline 1.");
String response = connection.readLine(); String response = connection.readLine();
if(response != null && response.trim().isEmpty() == false) if(response != null && response.trim().isEmpty() == false)
{ {
LOGGER.trace("TXS Runner Readline 1 Response: "+ response); LOGGER.trace("TXS Runner Readline 1 Response: "+ response);
} }
LOGGER.trace("TXS Runner Switching to Device. " + txsDevice); LOGGER.trace("TXS Runner Switching to Device. " + txsDevice);
//Send command to switch device: utec / tuner. //Send command to switch device: utec / tuner.
connection.write(device); connection.write(device);
//Read and Trace response switching device. //Read and Trace response switching device.
response = connection.readLine(); response = connection.readLine();
if(response != null && response.trim().isEmpty() == false) if(response != null && response.trim().isEmpty() == false)
{ {
LOGGER.trace("TXS Runner Readline 2 Response: "+ response); LOGGER.trace("TXS Runner Readline 2 Response: "+ response);
} }
LOGGER.trace("TXS Runner Start Logger."); LOGGER.trace("TXS Runner Start Logger.");
//Start device logger //Start device logger
connection.write(logger); connection.write(logger);
while (!stop) { while (!stop) {
//Get Response from TXS Device //Get Response from TXS Device
response = connection.readLine(); response = connection.readLine();
connection.write(logger); connection.write(logger);
//Continue if no data was received. //Continue if no data was received.
if (isNullOrEmpty(response)) { if (isNullOrEmpty(response)) {
continue; continue;
} }
//Trace response //Trace response
LOGGER.trace("TXS Runner Response: " + response); LOGGER.trace("TXS Runner Response: " + response);
//Split Values for parsing //Split Values for parsing
@ -138,7 +138,7 @@ public final class TxsRunner implements Stoppable{
public void stop() { public void stop() {
stop = true; stop = true;
} }
String[] SplitUtecString(String value) { String[] SplitUtecString(String value) {
try { try {
value = value.trim(); value = value.trim();
@ -150,27 +150,27 @@ public final class TxsRunner implements Stoppable{
return new String[]{}; return new String[]{};
} }
} }
void SetDataItemValues(String[] values) { void SetDataItemValues(String[] values) {
for (TxsDataItem dataItem : dataItems) for (TxsDataItem dataItem : dataItems)
{ {
if(dataItem != null) if(dataItem != null)
{ {
//Set value to dataItem //Set value to dataItem
if(values.length <= dataItem.getItemIndex()) if(values.length <= dataItem.getItemIndex())
{ {
LOGGER.trace("TXS DataItem: " + dataItem.getName() + " Index requested: " + dataItem.getItemIndex() + " TXS data size: " + values.length); LOGGER.trace("TXS DataItem: " + dataItem.getName() + " Index requested: " + dataItem.getItemIndex() + " TXS data size: " + values.length);
dataItem.setData(0); dataItem.setData(0);
} }
else else
{ {
LOGGER.trace("TXS Setting DataItem: " + dataItem.getName()); LOGGER.trace("TXS Setting DataItem: " + dataItem.getName());
dataItem.setData(parseDouble(values[dataItem.getItemIndex()])); dataItem.setData(parseDouble(values[dataItem.getItemIndex()]));
} }
} }
} }
} }
private double parseDouble(String value) { private double parseDouble(String value) {
try { try {
//try to parse value. //try to parse value.

View File

@ -1,6 +1,6 @@
/* /*
* RomRaider Open-Source Tuning, Logging and Reflashing * RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com * Copyright (C) 2006-2015 RomRaider.com
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -41,9 +41,9 @@ public final class TxsDataItem implements ExternalDataItem, DataListener {
} }
public int getItemIndex(){ public int getItemIndex(){
return itemIndex; return itemIndex;
} }
public String getName() { public String getName() {
return name; return name;
} }
@ -63,4 +63,4 @@ public final class TxsDataItem implements ExternalDataItem, DataListener {
public EcuDataConvertor[] getConvertors() { public EcuDataConvertor[] getConvertors() {
return convertors; return convertors;
} }
} }

View File

@ -1,6 +1,6 @@
/* /*
* RomRaider Open-Source Tuning, Logging and Reflashing * RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2014 RomRaider.com * Copyright (C) 2006-2015 RomRaider.com
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -64,7 +64,7 @@ public class SettingsManager {
else { else {
sf = new File(USER_HOME + SETTINGS_FILE); sf = new File(USER_HOME + SETTINGS_FILE);
settingsFileIn = new FileInputStream(sf); settingsFileIn = new FileInputStream(sf);
} }
final InputSource src = new InputSource(settingsFileIn); final InputSource src = new InputSource(settingsFileIn);
final DOMSettingsUnmarshaller domUms = new DOMSettingsUnmarshaller(); final DOMSettingsUnmarshaller domUms = new DOMSettingsUnmarshaller();
@ -91,7 +91,7 @@ public class SettingsManager {
final DOMSettingsBuilder builder = new DOMSettingsBuilder(); final DOMSettingsBuilder builder = new DOMSettingsBuilder();
try { try {
final File newDir = new File(settingsDir); final File newDir = new File(settingsDir);
newDir.mkdir(); // Creates directory if it does not exist newDir.mkdir(); // Creates directory if it does not exist
final File sf = new File(settingsDir + SETTINGS_FILE); final File sf = new File(settingsDir + SETTINGS_FILE);
builder.buildSettings(newSettings, sf, progress, VERSION); builder.buildSettings(newSettings, sf, progress, VERSION);
settings = newSettings; settings = newSettings;