mirror of https://github.com/rusefi/RomRaider.git
cleanup
git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@438 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
parent
1798788550
commit
af35b7c210
|
@ -21,31 +21,6 @@
|
|||
|
||||
package enginuity.logger;
|
||||
|
||||
import java.awt.*;
|
||||
import static java.awt.BorderLayout.*;
|
||||
import static java.awt.Color.BLACK;
|
||||
import static java.awt.Color.RED;
|
||||
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.util.Collections.sort;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.swing.*;
|
||||
import static javax.swing.JLabel.RIGHT;
|
||||
import static javax.swing.JScrollPane.*;
|
||||
import static javax.swing.JSplitPane.HORIZONTAL_SPLIT;
|
||||
import static javax.swing.JSplitPane.VERTICAL_SPLIT;
|
||||
import static javax.swing.JTabbedPane.BOTTOM;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import static javax.swing.border.BevelBorder.LOWERED;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableModel;
|
||||
import enginuity.Settings;
|
||||
import enginuity.io.port.SerialPortRefresher;
|
||||
import enginuity.logger.comms.controller.LoggerController;
|
||||
|
@ -53,9 +28,24 @@ import enginuity.logger.comms.controller.LoggerControllerImpl;
|
|||
import enginuity.logger.comms.query.EcuInit;
|
||||
import enginuity.logger.comms.query.EcuInitCallback;
|
||||
import enginuity.logger.comms.query.LoggerCallback;
|
||||
import enginuity.logger.definition.*;
|
||||
import enginuity.logger.profile.*;
|
||||
import enginuity.logger.ui.*;
|
||||
import enginuity.logger.definition.EcuData;
|
||||
import enginuity.logger.definition.EcuDataLoader;
|
||||
import enginuity.logger.definition.EcuDataLoaderImpl;
|
||||
import enginuity.logger.definition.EcuParameter;
|
||||
import enginuity.logger.definition.EcuSwitch;
|
||||
import enginuity.logger.profile.UserProfile;
|
||||
import enginuity.logger.profile.UserProfileImpl;
|
||||
import enginuity.logger.profile.UserProfileItem;
|
||||
import enginuity.logger.profile.UserProfileItemImpl;
|
||||
import enginuity.logger.profile.UserProfileLoader;
|
||||
import enginuity.logger.profile.UserProfileLoaderImpl;
|
||||
import enginuity.logger.ui.DataRegistrationBroker;
|
||||
import enginuity.logger.ui.DataRegistrationBrokerImpl;
|
||||
import enginuity.logger.ui.EcuDataComparator;
|
||||
import enginuity.logger.ui.EcuLoggerMenuBar;
|
||||
import enginuity.logger.ui.MessageListener;
|
||||
import enginuity.logger.ui.SerialPortComboBox;
|
||||
import enginuity.logger.ui.StatusIndicator;
|
||||
import enginuity.logger.ui.handler.DataUpdateHandler;
|
||||
import enginuity.logger.ui.handler.DataUpdateHandlerManager;
|
||||
import enginuity.logger.ui.handler.DataUpdateHandlerManagerImpl;
|
||||
|
@ -74,6 +64,38 @@ import static enginuity.util.ParamChecker.checkNotNull;
|
|||
import static enginuity.util.ParamChecker.isNullOrEmpty;
|
||||
import static enginuity.util.ThreadUtil.sleep;
|
||||
|
||||
import javax.swing.*;
|
||||
import static javax.swing.JLabel.RIGHT;
|
||||
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;
|
||||
import static javax.swing.JSplitPane.HORIZONTAL_SPLIT;
|
||||
import static javax.swing.JSplitPane.VERTICAL_SPLIT;
|
||||
import static javax.swing.JTabbedPane.BOTTOM;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import static javax.swing.border.BevelBorder.LOWERED;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableModel;
|
||||
import java.awt.*;
|
||||
import static java.awt.BorderLayout.CENTER;
|
||||
import static java.awt.BorderLayout.EAST;
|
||||
import static java.awt.BorderLayout.NORTH;
|
||||
import static java.awt.BorderLayout.SOUTH;
|
||||
import static java.awt.BorderLayout.WEST;
|
||||
import static java.awt.Color.BLACK;
|
||||
import static java.awt.Color.RED;
|
||||
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.util.Collections.sort;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
TODO: add better debug logging, preferably to a file and switchable (on/off)
|
||||
TODO: Clean up this class!
|
||||
|
@ -204,8 +226,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
public void loadLoggerConfig() {
|
||||
try {
|
||||
EcuDataLoader dataLoader = new EcuDataLoaderImpl();
|
||||
dataLoader.loadFromXml(settings.getLoggerConfigFilePath(), settings.getLoggerProtocol(),
|
||||
settings.getFileLoggingControllerSwitchId(), ecuInit);
|
||||
dataLoader.loadFromXml(settings.getLoggerConfigFilePath(), settings.getLoggerProtocol(), settings.getFileLoggingControllerSwitchId(), ecuInit);
|
||||
List<EcuParameter> ecuParams = dataLoader.getEcuParameters();
|
||||
addConvertorUpdateListeners(ecuParams);
|
||||
loadEcuParams(ecuParams, null);
|
||||
|
@ -258,8 +279,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
}
|
||||
}
|
||||
|
||||
private void applyUserProfileToLiveDataTabParameters(ParameterListTableModel paramListTableModel,
|
||||
UserProfile profile) {
|
||||
private void applyUserProfileToLiveDataTabParameters(ParameterListTableModel paramListTableModel, UserProfile profile) {
|
||||
List<ParameterRow> rows = paramListTableModel.getParameterRows();
|
||||
for (ParameterRow row : rows) {
|
||||
EcuData ecuData = row.getEcuData();
|
||||
|
@ -267,8 +287,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
}
|
||||
}
|
||||
|
||||
private void applyUserProfileToGraphTabParameters(ParameterListTableModel paramListTableModel,
|
||||
UserProfile profile) {
|
||||
private void applyUserProfileToGraphTabParameters(ParameterListTableModel paramListTableModel, UserProfile profile) {
|
||||
List<ParameterRow> rows = paramListTableModel.getParameterRows();
|
||||
for (ParameterRow row : rows) {
|
||||
EcuData ecuData = row.getEcuData();
|
||||
|
@ -362,15 +381,12 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
public UserProfile getCurrentProfile() {
|
||||
Map<String, UserProfileItem> paramProfileItems = getProfileItems(dataTabParamListTableModel.getParameterRows(),
|
||||
graphTabParamListTableModel.getParameterRows(), dashboardTabParamListTableModel.getParameterRows());
|
||||
Map<String, UserProfileItem> switchProfileItems = getProfileItems(
|
||||
dataTabSwitchListTableModel.getParameterRows(),
|
||||
Map<String, UserProfileItem> switchProfileItems = getProfileItems(dataTabSwitchListTableModel.getParameterRows(),
|
||||
graphTabSwitchListTableModel.getParameterRows(), dashboardTabSwitchListTableModel.getParameterRows());
|
||||
return new UserProfileImpl((String) portsComboBox.getSelectedItem(), paramProfileItems, switchProfileItems);
|
||||
}
|
||||
|
||||
private Map<String, UserProfileItem> getProfileItems(List<ParameterRow> dataTabRows,
|
||||
List<ParameterRow> graphTabRows,
|
||||
List<ParameterRow> dashTabRows) {
|
||||
private Map<String, UserProfileItem> getProfileItems(List<ParameterRow> dataTabRows, List<ParameterRow> graphTabRows, List<ParameterRow> dashTabRows) {
|
||||
Map<String, UserProfileItem> profileItems = new HashMap<String, UserProfileItem>();
|
||||
for (ParameterRow dataTabRow : dataTabRows) {
|
||||
String id = dataTabRow.getEcuData().getId();
|
||||
|
@ -412,21 +428,15 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
}
|
||||
|
||||
private JComponent buildTabbedPane() {
|
||||
tabbedPane.add("Data", buildSplitPane(
|
||||
buildParamListPane(dataTabParamListTableModel, dataTabSwitchListTableModel), buildDataTab()));
|
||||
tabbedPane.add("Graph", buildSplitPane(
|
||||
buildParamListPane(graphTabParamListTableModel, graphTabSwitchListTableModel), buildGraphTab()));
|
||||
tabbedPane.add("Dashboard", buildSplitPane(
|
||||
buildParamListPane(dashboardTabParamListTableModel, dashboardTabSwitchListTableModel),
|
||||
buildDashboardTab()));
|
||||
tabbedPane.add("Data", buildSplitPane(buildParamListPane(dataTabParamListTableModel, dataTabSwitchListTableModel), buildDataTab()));
|
||||
tabbedPane.add("Graph", buildSplitPane(buildParamListPane(graphTabParamListTableModel, graphTabSwitchListTableModel), buildGraphTab()));
|
||||
tabbedPane.add("Dashboard", buildSplitPane(buildParamListPane(dashboardTabParamListTableModel, dashboardTabSwitchListTableModel), buildDashboardTab()));
|
||||
return tabbedPane;
|
||||
}
|
||||
|
||||
private JComponent buildParamListPane(TableModel paramListTableModel, TableModel switchListTableModel) {
|
||||
JScrollPane paramList = new JScrollPane(buildParamListTable(paramListTableModel), VERTICAL_SCROLLBAR_AS_NEEDED,
|
||||
HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
JScrollPane switchList = new JScrollPane(buildParamListTable(switchListTableModel),
|
||||
VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
JScrollPane paramList = new JScrollPane(buildParamListTable(paramListTableModel), VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
JScrollPane switchList = new JScrollPane(buildParamListTable(switchListTableModel), VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
JSplitPane splitPane = new JSplitPane(VERTICAL_SPLIT, paramList, switchList);
|
||||
splitPane.setDividerSize(2);
|
||||
splitPane.setDividerLocation(400);
|
||||
|
@ -440,8 +450,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
return paramListTable;
|
||||
}
|
||||
|
||||
private void changeColumnWidth(JTable paramListTable, int colIndex, int minWidth, int maxWidth,
|
||||
int preferredWidth) {
|
||||
private void changeColumnWidth(JTable paramListTable, int colIndex, int minWidth, int maxWidth, int preferredWidth) {
|
||||
TableColumn column = paramListTable.getColumnModel().getColumn(colIndex);
|
||||
column.setMinWidth(minWidth);
|
||||
column.setMaxWidth(maxWidth);
|
||||
|
|
Loading…
Reference in New Issue